Travis CI build failing after dependency updates for my website project

Hi everyone, I maintain a small content-based website that focuses on restaurant reviews, menus, and deals — particularly for chains like Texas Roadhouse. The website is built using a static site generator and deployed automatically through Travis CI to my hosting server. Everything had been working smoothly for months, but recently, my Travis builds started failing out of nowhere right after I updated a few dependencies. I can’t figure out what’s causing it, since the same code builds fine locally on my machine.

The project uses Node.js (v20) for generating the static site, with a few npm packages for templating and minification. Travis runs a standard .travis.yml config that installs dependencies, runs a build script, and then deploys the output folder to the server via SSH. After updating packages like gulp, sass, and html-minifier, my builds began failing at the “Build script” step with the error:

Error: Cannot find module ‘node:fs/promises’

This doesn’t make sense because my local environment handles the same modules perfectly fine. I even tried downgrading Node in Travis to v18 and v16, but then the build started failing due to incompatible dependencies.

I’ve double-checked the .travis.yml setup, and it looks like this:

language: node_js
node_js:

“20”
cache:
directories:

node_modules
script:

npm install

npm run build
deploy:
provider: script
script: bash deploy.sh
on:
branch: main

Even after clearing the Travis cache multiple times, the same build error persists. I also tried adding nvm install 20 in the before_install step to ensure a clean environment, but it didn’t help.

Another issue I’ve noticed is that Travis seems to be using an outdated Linux image for my builds (bionic), and I wonder if that could be part of the problem. The logs show a few deprecation warnings related to Node’s built-in modules. I tried setting dist: focal and dist: jammy, but the builds either failed earlier or produced missing dependency errors. Maybe I need to upgrade the Travis environment entirely, but I’m not sure what the best practice is for Node-based sites now.

Has anyone else encountered similar Node module resolution issues on Travis after updating dependencies? Should I be switching to the npm ci command or adjusting my build scripts to handle newer Node features differently? Any advice on keeping Travis builds stable across environment updates would be greatly appreciated — my restaurant website depends on automated builds for daily content updates, and right now I’m stuck manually deploying every change.

Is there anyone who can help me?

Hey @joedeen4,

From reading the build logs, the node: protocol prefix for built-in modules (like node:fs/promises instead of just fs/promises) was introduced in Node.js v14.18.0 and v16.0.0, but it became more widely used and sometimes required by newer npm packages. One of your updated dependencies (gulp, sass, or html-minifier, or one of their dependencies) is now using this syntax.

The problem is that while Node 20 supports this perfectly, Travis CI’s build environment might have issues with how modules are resolved.

Try this .travis.yml and make sure dist: jammy is at the top:

dist: jammy
language: node_js
node_js:
  - "20"

cache:
  npm: true

before_install:
  - node --version
  - npm --version

install:
  - npm ci

script:
  - npm run build

deploy:
  provider: script
  script: bash deploy.sh
  skip_cleanup: true
  on:
    branch: main

I hope this helps.

Michael “Montana” Mendy.