Node.js Heroku部署 - 无法执行后安装脚本以安装Bower [英] Node.js Heroku Deployment - Fails To Exec Postinstall Script To Install Bower

查看:178
本文介绍了Node.js Heroku部署 - 无法执行后安装脚本以安装Bower的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的Node.js MEAN应用程序部署到heroku失败,并显示以下错误。我无法弄清楚bower安装有什么问题......

Deployment of my Node.js MEAN app to heroku fails with the following errors. I can't figure out what is wrong with the bower install...

以下是错误消息:

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

Here is my 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

Here is my 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"
},


推荐答案

我也遇到了这个错误。由于安装后安装,每第三次推送到heroku都会失败。

I get this error a lot too. every third push to heroku fails because of bower postinstall.

虽然这不是一个可靠的修复程序,但我不完全明白它为何有所帮助!尽管/ lib文件夹正在被添加到.gitignore,但在部署heroku之前,强制添加它。

While this is not a robust fix, and I don't fully understand why it helps! but this hepled me, so hopefully will help someone else.


$ b

Despite /lib folder is being added to .gitignore, force add it before deploying heroku

git add -f public/lib
git commit -m "force add bower libs"
git push heroku master

这篇关于Node.js Heroku部署 - 无法执行后安装脚本以安装Bower的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆