我定期部署到Heroku,过去一切正常。然后,仅更改一行代码并将其推送到Heroku后就失败了。
我还没有更新或安装任何东西。这种行为对我来说似乎太奇怪了。
\-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.18.1
engines.npm (package.json): unspecified (use default)
Resolving node version 12.18.1...
Downloading and installing node 12.18.1...
Using default npm version: 6.14.5
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
> fsevents@1.2.9 install /tmp/build_afdd9f79/node_modules/fsevents
> node install
npm ERR! Cannot read property 'length' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.Lt04X/_logs/2020-09-10T20_50_40_685Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
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",
"build": "npm run production",
"postinstall": "npm run prod",
"heroku-postbuild": "npm run prod"
},
"devDependencies": {
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"browser-sync": "^2.26.7",
"browser-sync-webpack-plugin": "^2.2.2",
"cross-env": "^5.1",
"jquery": "^3.5.1",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.13",
"popper.js": "^1.16.1",
"resolve-url-loader": "^2.3.1",
"sass": "^1.26.9",
"sass-loader": "7.*",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11"
},
"dependencies": {
"@chenfengyuan/vue-number-input": "^1.2.1",
"country-list": "^2.2.0",
"moment": "^2.27.0",
"vue-cool-lightbox": "^2.5.1",
"vue-loading-overlay": "^3.3.2",
"vue-moment": "^4.1.0",
"vue-recaptcha": "^1.3.0",
"vue-resource": "^1.5.1",
"vue-router": "^3.3.4",
"vue-select": "^3.10.3",
"vue-stripe-elements-plus": "^0.3.2",
"vuex": "^3.4.0"
},
"engines": {
"node": "12.18.1"
}
}
这可能是什么原因?
答案 0 :(得分:1)
尽管不是严格解决问题的方法,但我可以通过将项目迁移到Yarn来克服此错误。
答案 1 :(得分:0)
我通过消除“后安装”脚本而只使用此行来使其工作:
“ heroku-postbuild”:“ npm运行生产”