问题
I am getting a series of error when I try to push to heroku master.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! bower install
The docs https://devcenter.heroku.com/articles/nodejs-support showed me how to add bower
Here is my package.json. I am not sure what I could be missing. I have my engine and npm identified.
{
"name": "caffeine",
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "bower install",
"start": "node app.js"
},
"dependencies": {
"body-parser": "~1.12.0",
"cookie-parser": "~1.3.4",
"debug": "~2.1.1",
"express": "~4.12.2",
"express-session": "^1.11.3",
"jade": "~1.9.2",
"moment": "^2.10.3",
"mongoose": "^4.0.2",
"morgan": "~1.5.1",
"node-phantom-simple": "^1.2.0",
"passport": "^0.2.2",
"passport-facebook": "^2.0.0",
"passport-google-oauth": "^0.2.0",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^1.0.0",
"serve-favicon": "^2.2.0",
"should": "^6.0.3",
"swig": "^1.4.2"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-jshint": "^1.11.0",
"gulp-nodemon": "^2.0.3"
},
"engines": {
"node": "0.10.29",
"npm": "2.1.11"
}
}
回答1:
First try to determine if the problem is at Heroku or locally with your packages/bower setup. Try this:
Remove your bower_components directory and then run bower install
. When I did this angular needed help with resolving its version. I chose one of the alternatives, prefixed it with a "!" which added this to my bower.json:
"resolutions": {
"angular": "~1.3.8"
}
Then depolyed and the postinstall worked. The bottom line is that bower install should recreate the deleted bower_components without any fuzz locally, before you tell Heroku to run it.
来源:https://stackoverflow.com/questions/31106876/errors-deploying-to-heroku