Railway uses wrong version of npm

maksynshTRIAL

a year ago

So in my application's package.json I specified versions
"engines": {
"node": "20.x",
"npm": "10.x"
},

NPM version should be 10.x, but Railway uses 8.x for some reason which leads to npm ci errors

View Deploy

4 Replies

a year ago

Try specifying your npm version as shown here - https://nixpacks.com/docs/providers/node#corepack


maksynshTRIAL

a year ago

It didn't help, unfortunately
╔══════════════════════════════ Nixpacks v1.21.2 ══════════════════════════════╗

║ setup │ nodejs20, npm-8x, libnss3, libatk1.0-0, libatk-bridge2.0-0, ║

║ │ libcups2, libgbm1, libasound2, libpangocairo-1.0-0, libxss1, ║

║ │ libgtk-3-0, libxshmfence1, libglu1 ║

║──────────────────────────────────────────────────────────────────────────────║

║ install │ npm ci ║

║──────────────────────────────────────────────────────────────────────────────║

║ build │ npm install ║

║──────────────────────────────────────────────────────────────────────────────║

║ start │ npm run start:prod ║

╚══════════════════════════════════════════════════════════════════════════════╝


a year ago

Turns out Nixpacks has no support for npm 10, You would have to do your build with a Dockerfile.


a year ago

Additionally, Instead of installing Chrome into your deployment with Pupperter, use Browserless

Without installing Chrome and all its system dependencies, your build and deploys will be much faster.

Here's an example repo showing you how to do that https://github.com/brody192/puppeteer-example


Railway uses wrong version of npm - Railway Help Station