node.js - 推送到 Heroku 时出错 : Cannot find module 'node-linux-x64/package.json'

标签 node.js reactjs git express heroku

将全栈 Javascript 应用部署到 Heroku 时,我收到以下错误:

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

还有一个语法错误,但我不认为这是原因。

我是 Mac 用户,所以我不确定发生了什么。我检查了语法错误,但什么也没发现。我还尝试卸载并重新安装 Node 等...

输出:

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

最佳答案

我最终删除了在 package.json 中安装的 Node 依赖项,它的效果非常好。感谢大家的回答,希望这对遇到此问题的其他人有所帮助。

关于node.js - 推送到 Heroku 时出错 : Cannot find module 'node-linux-x64/package.json' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56757471/

相关文章:

javascript - 文件更改时 Webpack 开发服务器不会重新编译

node.js - MongoDB 中的值未更新

javascript - 无法读取 null 的属性(读取 'store' )

javascript - 在哪里可以找到 Spring Petclinic 的 Angular JS fork ?

git - 将 "local"数据工厂更改提交到 Azure DevOps GIT

git - 创建一个分支别名并推送它

node.js - Nodejs - 另一个安装正在进行中

node.js - 使用nodejs制作Slack机器人,Slack事件不起作用

ruby-on-rails - 使用 React Rails 显示关联的模型数据

javascript - React 无法识别 DOM 元素上的 `justifyContent` 属性