[Pages] npm install on subfolder

For Workers & Pages, what is the name of the domain?

peopleupgrader.com

What is the issue or error you’re encountering

Npm scripts not working properly

What are the steps to reproduce the issue?

I’m trying to run a build script for a sub app which is an spa that’s built using vite. My npm build scripts is pretty simple:

"build": "npm install --include=dev & vite build",

Locally this waits for npm install to finish before running the build but on the cloudflare pages build it tries to run both of these concurrently which causes an error as vite is not installed.

Some more detail:

2024-12-09T16:27:37.989508Z Cloning repository…
2024-12-09T16:27:38.875303Z From XXXXXXX · GitHub
2024-12-09T16:27:38.875781Z * branch xxxxx-> FETCH_HEAD
2024-12-09T16:27:38.875908Z
2024-12-09T16:27:38.907236Z HEAD is now at xxxxx test
2024-12-09T16:27:38.907658Z
2024-12-09T16:27:38.988165Z
2024-12-09T16:27:38.988757Z Using v2 root directory strategy
2024-12-09T16:27:39.009453Z Success: Finished cloning repository files
2024-12-09T16:27:40.576299Z Checking for configuration in a wrangler.toml configuration file (BETA)
2024-12-09T16:27:40.577009Z
2024-12-09T16:27:40.719413Z No wrangler.toml file found. Continuing.
2024-12-09T16:27:40.875152Z Detected the following tools from environment: [email protected], [email protected]
2024-12-09T16:27:40.875823Z Installing project dependencies: npm clean-install --progress=false
2024-12-09T16:27:43.387825Z
2024-12-09T16:27:43.388239Z added 26 packages, and audited 27 packages in 2s
2024-12-09T16:27:43.388424Z
2024-12-09T16:27:43.388624Z 6 packages are looking for funding
2024-12-09T16:27:43.388714Z run npm fund for details
2024-12-09T16:27:43.389557Z
2024-12-09T16:27:43.389722Z found 0 vulnerabilities
2024-12-09T16:27:43.402124Z Executing user command: npm run build --prefix app
2024-12-09T16:27:43.951542Z
2024-12-09T16:27:43.95177Z > [email protected] build
2024-12-09T16:27:43.951928Z > npm install --include=dev & vite build
2024-12-09T16:27:43.95205Z
2024-12-09T16:27:43.965271Z sh: 1: vite: not found
2024-12-09T16:27:43.978084Z node:events:652
2024-12-09T16:27:43.978343Z return this.listener.apply(this.target, arguments);
2024-12-09T16:27:43.978488Z ^
2024-12-09T16:27:43.978605Z
2024-12-09T16:27:43.978733Z q [Error]: Error while executing user command. Exited with error code: 127
2024-12-09T16:27:43.978867Z at ChildProcess. (/snapshot/dist/run-build.js)
2024-12-09T16:27:43.978993Z at Object.onceWrapper (node:events:652:26)
2024-12-09T16:27:43.979083Z at ChildProcess.emit (node:events:537:28)
2024-12-09T16:27:43.97915Z at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2024-12-09T16:27:43.979222Z
2024-12-09T16:27:43.979331Z Node.js v18.5.0
2024-12-09T16:27:46.222931Z
2024-12-09T16:27:46.223181Z added 81 packages, and audited 82 packages in 2s
2024-12-09T16:27:46.223504Z
2024-12-09T16:27:46.223614Z 17 packages are looking for funding
2024-12-09T16:27:46.223879Z run npm fund for details
2024-12-09T16:27:46.224451Z
2024-12-09T16:27:46.224663Z found 0 vulnerabilities
2024-12-09T16:27:46.236854Z Failed: build command exited with code: 1
2024-12-09T16:27:46.952869Z Failed: error occurred while running build command

Fixed it with && odd that’s the wrong way round never though.