简体   繁体   English

推送到Heroku时出错:找不到模块“ node-linux-x64 / package.json”

[英]Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json'

When deploying a fullstack Javascript app to Heroku, I receive the following error: 将完整的Javascript应用程序部署到Heroku时,出现以下错误:

 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. 我是Mac用户,所以我不确定发生了什么。 I've checked for the syntax error, but found nothing. 我检查了语法错误,但一无所获。 I also tried uninstalling and reinstalling Node, etc... 我也尝试卸载并重新安装Node等。

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

Not sure if this is going to work but try adding this to your package.json: 不知道这是否行得通,但尝试将其添加到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 并重建您的项目将“目标”更改为所需的节点版本

I ended up deleting the node dependency I installed in my package.json and it worked like a charm. 我最终删除了我在package.json中安装的节点依赖项,它的工作原理很吸引人。 Thanks for the answers guys, hope this helps anyone else that runs into this. 谢谢你们的回答,希望这对遇到此问题的其他人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到模块 'node-linux-x64/package.json' - 第一次推送到 Heroku - Error: Cannot find module 'node-linux-x64/package.json' - pushing to Heroku for first time 无法推送到 Heroku:找不到模块“node-linux-x64/package.json” - Unable to push to Heroku: Cannot find module 'node-linux-x64/package.json' 错误:找不到模块“../../package.json” - Error: Cannot find module '../../package.json' Openshift部署错误:找不到模块package.json - Openshift deploy error: Cannot find module package.json 为什么 Heroku 告诉我它在我的模块中找不到 package.json 当我执行 Z3115FB307DFCB5BA733BZ76 时 - Why is Heroku telling me it cannot find a package.json in my module when I do a heroku push 电子找不到模块 package.json - electron cannot find module package.json Heroku - 部署时 package.json 中未指定节点版本 - Heroku - Node version not specified in package.json while deployment 在laravel-echo-server中找不到模块&#39;node-v46-linux-x64 / node_sqlite3.node&#39;错误 - Cannot find module 'node-v46-linux-x64/node_sqlite3.node' error in laravel-echo-server 当它同时位于package.json和node_modules中时,“找不到模块” - “Cannot Find Module”, when it is both in package.json and node_modules 推送到 Heroku 时出现 package.json/package-lock.json 同步错误 - Getting package.json/package-lock.json sync error when pushing to Heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM