DEV Community

Discussion on: How to create a simple and beautiful chat with MongoDB, Express, React and Node.js (MERN stack)

syedabrar003 profile image

I'm unable to deploy the master branch. I'm getting an error in the build.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /tmp/build_4120397c_/client/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_4120397c_/client/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.VwQor/_logs/2020-08-04T20_56_07_801Z-debug.log
   npm ERR! code ELIFECYCLE
   npm ERR! errno 254
   npm ERR! chatfinal@1.0.0 postinstall: `npm install --prefix ./server && npm install --prefix ./client && npm run build --prefix ./client`
   npm ERR! Exit status 254
   npm ERR! 
   npm ERR! Failed at the chatfinal@1.0.0 postinstall script.
   npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.VwQor/_logs/2020-08-04T20_56_07_826Z-debug.log
Enter fullscreen mode Exit fullscreen mode

-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:

   Some possible problems:

   - Node version not specified in package.json

Enter fullscreen mode Exit fullscreen mode

! Push rejected, failed to compile Node.js app.
! Push failed

nicodeio profile image
Nicolas Denoël • Edited on

Hello, I have the same kind of issue first the same as syedabra003 but I added the node version to my package.json and then the error switched now to this one. I'm at the early step of the guide, when trying manual deploy with Heroku, I started from scratch two times but still the same result, 'npm run dev' runs fine on local so if any clues ? Thanks !

armelpingault profile image
Armel Author

Hi, how do you reproduce the error exactly? Which command do you try to execute? Thanks

syedabrar003 profile image

I followed every step in the post. This output is occurred when I entered 'npm run dev' in terminal.

prachita11 profile image
Prachita Nayak

Hi , I faced the same issue , but in my case there was a .git folder present in my client folder which was preventing the deploy . just delete that .git folder and reinitialise your repository and the build will automatically start on heroku.