Heroku Deploy-“推送被拒绝,无法编译Node.js应用程序”

时间:2020-06-05 11:42:34

标签: node.js laravel vue.js heroku

尝试将Laravel + vue应用程序部署到heroku,但是使用git push heroku master时,我得到以下跟踪信息(仅显示了整个跟踪的一部分,但我认为这是问题所在的一部分-如果不让它我知道):

remote:        npm ERR! code EINTEGRITY
remote:        npm ERR! sha512- 
Prh/h9CB1jBCBIjSLD6kvIWhMV5S25Bwv7yK0fYJSOTIyg1CmU9OqNdRVCkdWyQY1Hkvm+1YdXJzh3xYupq1KA== 
integrity checksum failed when using sha512: wanted sha512- 
Prh/h9CB1jBCBIjSLD6kvIWhMV5S25Bwv7yK0fYJSOTIyg1CmU9OqNdRVCkdWyQY1Hkvm+1YdXJzh3xYupq1KA== but 
got sha512- 
QItiGZBy5TstGy+q8mjQTMGRlDDOARXLxH+sgVm1n/LYeo0zFcQlcCh8m4zi8QxctrxB9Kue/lStc/RD5iLadQ==. 
(896052 bytes)
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.8lpmC/_logs/2020-06-05T11_28_24_085Z-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:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js- 
version
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 

这是我的package.json

{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"postinstall": "npm run prod",
"heroku-postbuild": "npm run prod"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.5.1",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
},
"dependencies": {
"@fullcalendar/core": "^4.4.0",
"@fullcalendar/daygrid": "^4.4.0",
"@fullcalendar/interaction": "^4.4.0",
"@fullcalendar/vue": "^4.4.0",
"@types/dhtmlxgantt": "^6.0.2",
"admin-lte": "^3.0.2",
"babel-runtime": "^6.26.0",
"bootstrap-vue": "^2.15.0",
"dhtmlx-gantt": "^6.3.7",
"laravel-echo": "^1.7.0",
"laravel-vue-pagination": "^2.3.1",
"mdbvue": "^6.7.0",
"moment": "^2.24.0",
"pusher-js": "^5.1.1",
"sweetalert2": "^9.8.2",
"vform": "^1.0.1",
"vue-full-calendar": "^2.7.0",
"vue-print-nb": "^1.5.0",
"vue-progressbar": "^0.7.5",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},
"engines": {
"node": "12.x"
}
}

内部存在很多错误,我不知道为什么会这样。但是经过大量研究,我尝试了许多方法,但没有找到解决方案。因此,自2天以来,我一直在这里困住任何帮助人员

3 个答案:

答案 0 :(得分:0)

使用Laravel应用程序和Rails应用程序指定engines对象块对我有帮助

package.json(添加)

"engines": {
    "node": "12.x"
}

排序奇数,但是当它起作用时,就会起作用。

我还添加了一个@dependabot rebase,以便使用heroku构建预览版本可以让我在分支机构中验证这是阻止应用程序构建的唯一问题。

答案 1 :(得分:0)

在您指定节点版本的地方,还要指定节点版本。 看看是否可行。它对我有用。

"engines": { "node": "12.x", "npm": "your version" }

答案 2 :(得分:0)

在终端中检查您的 node 和 npm 版本:

node -v

npm -v

并在 package.json 中更新两者(示例):

  "engines": {
    "node": "14.x",
    "npm": "7.x"
  }

仅仅放置 node 版本对我没有帮助,因为 heroku 自动尝试构建另一个版本的 npm 并崩溃

在此处阅读更多信息: https://devcenter.heroku.com/articles/deploying-nodejs#specify-the-version-of-node