0

(Story) So my MERN app works fine on localhost and all paths and json files have been taken care of... proxy, scrips, NODE_ENV, etc... then this new dumb error showed up. I have been trying to get this to work for a month. My file structure wasn't right before and I still got it to deploy by changing the deployment paths but the server was giving a 404 for the axios calls to MongoDB Atlas using Express.

So I put the whole thing together in the right file structure, set the environment variable for ATLAS_URI and after resolving a ton of errors I am stuck on this last one, hopefully. Please help me get rid of it.

(Problem) Not able to deploy on heroku. It's working fine locally.

Error Log after doing git push heroku master

Total 4619 (delta 1796), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  ^8.15.0
remote:        engines.npm (package.json):   ^6.4.1
remote:        
remote:        Resolving node version ^8.15.0...
remote:        Downloading and installing node 8.17.0
remote:        Bootstrapping npm ^6.4.1 (replacing 6.13.4)...
remote:        npm ^6.4.1 installed
remote:        
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote:        Module installation may take longer for this build
remote:        
remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:        
remote:        > node@8.15.0 preinstall /tmp/build_a457d1d9/node_modules/node
remote:        > node installArchSpecificPackage
remote:        
remote:        /tmp/build_a457d1d9/node_modules/node/node_modules/.bin/node: 1: /tmp/build_a457d1d9/node_modules/node/node_modules/.bin/node: �����H: not found
remote:        /tmp/build_a457d1d9/node_modules/node/node_modules/.bin/node: 2: /tmp/build_a457d1d9/node_modules/node/node_modules/.bin/node: Syntax error: "(" unexpected
remote:        module.js:550
remote:            throw err;
remote:            ^
remote:        
remote:        Error: Cannot find module 'node-linux-x64/package.json'
remote:            at Function.Module._resolveFilename (module.js:548:15)
remote:            at Function.resolve (internal/module.js:18:19)
remote:            at ChildProcess.<anonymous> (/tmp/build_a457d1d9/node_modules/node-bin-setup/index.js:18:27)
remote:            at emitTwo (events.js:126:13)
remote:            at ChildProcess.emit (events.js:214:7)
remote:            at maybeClose (internal/child_process.js:915:16)
remote:            at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! node@8.15.0 preinstall: node installArchSpecificPackage
remote:        npm ERR! Exit status 1
remote:        npm ERR! 
remote:        npm ERR! Failed at the node@8.15.0 preinstall script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm new to this. Please tell me exactly what to do without much jargon. Any help is much appreciated. Thanks!

1 Answers1

0

Okay I found out how to do this. Just delete the node_modules folder in the source (server.. not client) directory and try again. It should work like a charm...

Found it here Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json' Thanks guys