MERN+gql project; Heroku deployment build failing at install script because "can't cd to server"

17 Views Asked by At

In the process of converting a project using a mysql db and an express server into one with the same concept (a free online game search application) but in a MERN+gql framework. After creating my gql schemas and testing them in my localhost, I attempted to push the project to Heroku in the hopes of connecting continuous deployment as I worked on the front end.

I have been unable to deploy to Heroku because each time I attempt a push to Heroku the build fails on my "install" scrip...a script that I have successfully used before in deploying MERN+gql projects on Heroku. ‍‍♀️

remote: -----> Installing dependencies
remote:        Installing node modules
remote:        
remote:        > [email protected] install
remote:        > cd server && npm i && cd ../client && npm i
remote:        
remote:        sh: 1: cd: can't cd to server
remote:        npm notice 
remote:        npm notice New major version of npm available! 9.9.2 -> 10.3.0
remote:        npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.3.0>
remote:        npm notice Run `npm install -g [email protected]` to update!
remote:        npm notice 
remote:        npm ERR! code 2
remote:        npm ERR! path /tmp/build_31774fbf
remote:        npm ERR! command failed
remote:        npm ERR! command sh -c cd server && npm i && cd ../client && npm i
remote:        
remote:        npm ERR! A complete log of this run can be found in: /tmp/npmcache.j8gTf/_logs/2024-01-18T00_51_37_422Z-debug-0.log
remote: 
remote: -----> Build failed

I have gone through the code to check for typos and inconsistancies but have found nothing. I'm really befuddled because it works as expected on my local host; it's just the deployment that's giving me trouble.

one-by-one I've... -double checked the environment variables in Heroku.
-looked carefully over my code for typos or inconsistencies.
-updated the npm v to 10.3.0 as the message from the build log suggested. -tried re-installing the dependancies manually. -tried breaking the install script in my root package.json
"install": "cd server && npm i && cd ../client && npm i"
into three separate scripts

"install": "npm run install-server && npm run install-client",
  "install-server": "cd server && npm i",
  "install-client": "cd client && npm i",

-banged my head against the wall
...all to receive the exact same error message. HAAAALP!

0

There are 0 best solutions below