Vue + Vite project not installing all dependencies in prod branch

I have two Vue project which are using nearly identical structure and Vite for building. I deployed one about 2 or 3 days ago without issue. I use a prod branch for production and a dev branch for preview. Today, I have been trying to get the second project up and running. It too has a prod branch and a dev branch. The dev branch is running just fine. However the prod one fails and says it cannot find vite.

Looking through the logs, I see that the dev branch added 872 packages, while the prod branch added 224 packages. My feeling is that probably the prod one is not installing the devDependencies in package.json. Vite is a devDependency. If this is the case, how might I resolve this?

Also, could it be related to this new error that people are starting to see regarding No Pages config file? 640393

I’ve only noticed this first today, and I double checked that this error was not present on the other project I successfully deployed a couple days ago.

Logs from dev branch:

10:02:15.082	Using v2 root directory strategy
10:02:15.108	Success: Finished cloning repository files
10:02:16.924	
10:02:17.017	✘ [ERROR] No Pages config file found
10:02:17.018	
10:02:17.019	
10:02:17.022	🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2024-04-10_14-02-16_743.log"
10:02:17.033	No wrangler.toml file found
10:02:18.204	Detected the following tools from environment: [email protected], [email protected]
10:02:18.205	Installing nodejs 20.12.1
10:02:18.799	Trying to update node-build... ok
10:02:19.033	Downloading node-v20.12.1-linux-x64.tar.gz...
10:02:19.033	-> https://nodejs.org/dist/v20.12.1/node-v20.12.1-linux-x64.tar.gz
10:02:20.770	Installing node-v20.12.1-linux-x64...
10:02:21.168	Installed node-v20.12.1-linux-x64 to /opt/buildhome/.asdf/installs/nodejs/20.12.1
10:02:21.168	
10:02:22.314	Installing project dependencies: npm clean-install --progress=false
10:02:31.054	npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
10:02:31.181	npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
10:02:38.464	
10:02:38.464	added 872 packages, and audited 873 packages in 16s
10:02:38.464	
10:02:38.464	174 packages are looking for funding
10:02:38.465	  run `npm fund` for details
10:02:38.466	
10:02:38.466	found 0 vulnerabilities

Logs from prod branch

10:37:27.034	Using v2 root directory strategy
10:37:27.057	Success: Finished cloning repository files
10:37:28.694	
10:37:28.788	✘ [ERROR] No Pages config file found
10:37:28.788	
10:37:28.788	
10:37:28.792	🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2024-04-10_14-37-28_519.log"
10:37:28.802	No wrangler.toml file found
10:37:29.969	Detected the following tools from environment: [email protected], [email protected]
10:37:29.970	Installing nodejs 20.12.1
10:37:30.583	Trying to update node-build... ok
10:37:30.788	Downloading node-v20.12.1-linux-x64.tar.gz...
10:37:30.788	-> https://nodejs.org/dist/v20.12.1/node-v20.12.1-linux-x64.tar.gz
10:37:32.365	Installing node-v20.12.1-linux-x64...
10:37:32.757	Installed node-v20.12.1-linux-x64 to /opt/buildhome/.asdf/installs/nodejs/20.12.1
10:37:32.757	
10:37:33.805	Installing project dependencies: npm clean-install --progress=false
10:37:38.638	
10:37:38.638	added 224 packages, and audited 225 packages in 4s
10:37:38.639	
10:37:38.639	16 packages are looking for funding
10:37:38.639	  run `npm fund` for details
10:37:38.640	
10:37:38.640	found 0 vulnerabilities

Okay, I must have done things in a different order with the first project - Adding in a NODE_ENV=production environment variable after the initial deployment. Anyway, I was correct that the devDependencies were not being installed. To resolve this, I followed the guide for moving build instructions per branch into a separate script.
Set build commands per branch

I then added a line for the production branch before the build command:

npm install --include=dev

With this in place, the dependencies were installed and everything deployed just fine.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.