1

When deploying a fullstack Javascript app to Heroku, I receive the following error:

Error: Cannot find module 'node-linux-x64/package.json'

There's also a syntax error, but I don't believe that's the cause.

I'm a Mac user, so I'm unsure of what's going on. I've checked for the syntax error, but found nothing. I also tried uninstalling and reinstalling Node, etc...

Output:

remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:
remote:        > node@12.4.0 preinstall /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node
remote:        > node installArchSpecificPackage
remote:
remote:        /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: 1: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: �����: not found
remote:        /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: 41: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: Syntax error: ")" unexpected
remote:        internal/modules/cjs/loader.js:638
remote:            throw err;
remote:            ^
remote:
remote:        Error: Cannot find module 'node-linux-x64/package.json'
remote:            at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
remote:            at Function.resolve (internal/modules/cjs/helpers.js:33:19)
remote:            at ChildProcess.<anonymous> (/tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node-bin-setup/index.js:18:27)
remote:            at ChildProcess.emit (events.js:198:13)
remote:            at maybeClose (internal/child_process.js:982:16)
remote:            at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! node@12.4.0 preinstall: `node installArchSpecificPackage`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the node@12.4.0 preinstall script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.nPBvI/_logs/2019-06-25T15_20_23_924Z-debug.log
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
slothiful
  • 5,548
  • 3
  • 12
  • 36
  • Delete the `nodes_modules` folder and start over with `npm i` –  Jun 25 '19 at 15:35
  • @davmich still throwing the error :/ so frustrating - Thank you for the response man hopefully i can figure this out without spending too much time on it – Jeremy Blong Jun 25 '19 at 15:44
  • Try this out: https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo/16151707#16151707 since it might be an `npm` issue. –  Jun 25 '19 at 15:47
  • For reference: https://github.com/kentcdodds/react-testing-workshop/issues/2 (this guy has the same issue) –  Jun 25 '19 at 15:49
  • @davmich I'm going to check out that link now! Good find brotha – Jeremy Blong Jun 25 '19 at 15:55
  • @davmich I'm going to try to totally uninstall and reinstall my dev dependencies. Is there a way i can give you a vote just for the fact you've been trying to help me? – Jeremy Blong Jun 25 '19 at 16:02

2 Answers2

3

I ended up deleting the node dependency I installed in my package.json and it worked like a charm. Thanks for the answers guys, hope this helps anyone else that runs into this.

1

Not sure if this is going to work but try adding this to your package.json:

"postinstall": "npm rebuild grpc --target=10.15.0 --target_arch=x64 --target_platform=linux --target_libc=glibc" 

to the scripts element as such

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "npm rebuild grpc --target=10.15.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
}

and rebuild your project Change the 'target' to your desired node version

Shen
  • 53
  • 5