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.