1

I'm really stuck and would really appreciate some help. This question was asked previously here Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json' however, despite trying all the suggestions I was still unable to resolve this problem.

Just like the individual before who posted the problem initially, I am trying to push a full stack Javascript app to Heroku.

I've re-installed all my dependencies and even downgraded my node and npm.

This issue is especially confusing as I am a Windows user, so to be receiving an error about a module regarding linux feels quite strange.

Please help.

C:\Users\Greg\Desktop\GregBots\reactbot> git push heroku master
Enumerating objects: 41, done.
Counting objects: 100% (41/41), done.
Delta compression using up to 8 threads
Compressing objects: 100% (28/28), done.
Writing objects: 100% (28/28), 19.45 KiB | 1.95 MiB/s, done.
Total 28 (delta 15), 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):  13.6.0
remote:        engines.npm (package.json):   6.13.4
remote:
remote:        Resolving node version 13.6.0...
remote:        Downloading and installing node 13.6.0...
remote:        npm 6.13.4 already installed with node
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:        Installing node modules (package.json + package-lock)
remote:
remote:        > node@13.8.0 preinstall /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node
remote:        > node installArchSpecificPackage
remote:
remote:        npm ERR! code ETARGET
remote:        npm ERR! notarget No matching version found for node-linux-x64@13.8.0.
remote:        npm ERR! notarget In most cases you or one of your dependencies are requesting
remote:        npm ERR! notarget a package version that doesn't exist.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.3VsTs/_logs/2020-02-26T01_02_25_357Z-debug.log
remote:        internal/modules/cjs/loader.js:976
remote:          throw err;
remote:          ^
remote:
remote:        Error: Cannot find module 'node-linux-x64/package.json'
remote:        Require stack:
remote:        - /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js
remote:            at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
remote:            at Function.resolve (internal/modules/cjs/helpers.js:78:19)
remote:            at ChildProcess.<anonymous> (/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node-bin-setup/index.js:18:27)
remote:            at ChildProcess.emit (events.js:321:20)
remote:            at maybeClose (internal/child_process.js:1028:16)
remote:            at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
remote:          code: 'MODULE_NOT_FOUND',
remote:          requireStack: [
remote:            '/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js'
remote:          ]
remote:        }
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! node@13.8.0 preinstall: `node installArchSpecificPackage`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the node@13.8.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.3VsTs/_logs/2020-02-26T01_02_26_775Z-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
remote:
remote:        Some possible problems:
remote:
remote:        - A module may be missing from 'dependencies' in package.json
remote:          https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to infinite-sea-94371.
remote:
To https://git.heroku.com/infinite-sea-94371.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/infinite-sea-94371.git'
PS C:\Users\Greg\Desktop\GregBots\reactbot>

Thanks a bunch for your suggestions Mazen. I've went through your advice, but can't deploy to Heroku still. I've now attached my package.json which I am pushing as well to Heroku as Heroku installs the dependencies that are needed as per the package.

    {
  "name": "reactbot",
  "version": "1.0.0",
  "description": "React bot",
  "main": "index.js",
  "engines": {
    "node": "13.6.0",
    "npm": "6.13.4"
  },
  "scripts": {
    "start": "node index.js",
    "backend": "nodemon index.js",
    "frontend": "npm run start --prefix client",
    "dev": "concurrently \"npm run backend\" \"npm run frontend\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "actions-on-google": "^2.12.0",
    "body-parser": "^1.19.0",
    "dialogflow": "^1.2.0",
    "dialogflow-fulfillment": "^0.6.1",
    "express": "^4.17.1",
    "mongoose": "^5.9.2"
  },
  "devDependencies": {
    "concurrently": "^5.1.0",
    "nodemon": "^2.0.2"
  }
}
Greg
  • 23
  • 5

1 Answers1

3

This error might be caused by multiple things:

  • According to your error, the npm package node-linux-x64 is set to the wrong version that doesn't exist. Remove node-linux-x64 as Heroku installs the most updated version of Node.js for their system or set it to an existing version.
  • Did you push your package.json file with your code?
  • You have pushed your node_module to Heroku which has certain versions of some packages that can only work on your distribution/OS.
  • You might have installed an npm package globally and forgot to include it to your packages.json file.
Mazen
  • 486
  • 4
  • 8
  • Eureka! It worked. Thanks so much Mazen. I think you were right about me installing globally and not including it in the package.json. You the man! – Greg Feb 26 '20 at 04:37
  • You are welcome! Please approve my answer for others to know. If you have any issues with Node.js or web dev, please write your question on StackOverflow and contact me. Good luck! – Mazen Feb 27 '20 at 04:18
  • I just realized that your problem hasn't been fixed yet. lol. Could you try to remove the engine object from your packages.json file and give it a try? – Mazen Feb 27 '20 at 04:31
  • I approved your answer as soon as it fixed my issue 2 days ago. Unfortunately I don’t have enough “rep” as per stackoverflow to change the public display, I.e. the approval number. – Greg Feb 28 '20 at 05:07