将我的 Node.js MEAN 应用程序部署到 heroku 失败并出现以下错误。我无法弄清楚 bower 安装有什么问题......
这是错误信息:
2606 info postinstall App@1.0.0
2607 verbose unsafe-perm in lifecycle true
2608 info App@1.0.0 Failed to exec postinstall script
2609 error App@1.0.0 postinstall: `./node_modules/bower/bin/bower install`
2609 error Exit status 1
2610 error Failed at the App@1.0.0 postinstall script.
2610 error This is most likely a problem with the App package,
2610 error not with npm itself.
2610 error Tell the author that this fails on your system:
2610 error ./node_modules/bower/bin/bower install
! Push rejected, failed to compile Node.js app
这是我的 Bower.json
{
"name": "mean",
"version": "1.0.0",
"dependencies": {
"bootstrap": "*",
"angular": "*",
"angular-resource": "*",
"angular-cookies": "*",
"angular-ui-utils": "*",
"angular-bootstrap": "*",
"json3": "*",
"jquery": "*",
"angular-ui-router": "*",
"angular-animate": "*",
"move.js": "git://github.com/visionmedia/move.js.git#~0.3.3",
"animate.css": "*",
"ngAnimate-animate.css": "*",
"angularLocalStorage": "~0.1.7",
"jquery-nicescroll": "*"
},
"resolutions": {
"angular": "1.2.4"
}
}
这是我的 Package.json
"scripts": {
"start": "node node_modules/grunt-cli/bin/grunt",
"test": "node node_modules/grunt-cli/bin/grunt test",
"postinstall": "./node_modules/bower/bin/bower install"
},
最佳答案
我也经常遇到这个错误。由于 bower postinstall,每三次推送到 heroku 都会失败。
虽然这不是一个强大的修复程序,但我不完全理解它为什么会有所帮助!但这对我有帮助,所以希望能帮助其他人。
尽管/lib 文件夹正在添加到 .gitignore,但在部署 heroku 之前强制添加它
git add -f public/lib
git commit -m "force add bower libs"
git push heroku master
关于javascript - Node.js Heroku 部署 - 无法执行安装后脚本来安装 Bower,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20826580/