node.js - AWS - 通过 npm install 安装 bower 组件

标签 node.js git npm amazon-elastic-beanstalk bower

我正在尝试使用 git aws.push 方法启动 node.js 服务器

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.sdlc.html

与此解决方案类似,我正在尝试运行“bower 安装”,但我的解决方案有点不同:

https://developer.ibm.com/answers/questions/16594/how-to-install-packages-on-nodejs/

我的实现:

“脚本”:{
"postinstall": "bower 安装 -F"
},

这在本地工作正常 - npm install 也可以毫无问题地运行 bower install。当我部署到 aws 时,npm 运行良好 - 我知道我的服务器启动正常,因为我可以在日志中看到来自它的消息,但是当我尝试启动客户端时,没有任何 bower 组件就位。

我正在使用 node v0.10.26,并且我确定我没有在本地计算机上全局安装 bower。我已经尝试过在 package.json 的依赖项部分包含和不包含 bower 的情况。

有任何想法吗?并提前致谢。

包.json

{
  "name": "smf",
  "version": "0.1.0",
  "dependencies": {
    "aws-sdk": "~2.0.0-rc.14",
    "base64-js": "0.0.6",
    "bookshelf": "~0.6.10",
    "bower": "*",
    "change-case": "~2.1.1",
    "crypto-js": "~3.1.2-3",
    "geojson": "~0.1.5",
    "handlebars": "~2.0.0-alpha.2",
    "js-base64": "~2.1.5",
    "lodash": "~2.4.1",
    "mathjs": "~0.21.0",
    "minify": "~0.5.1",
    "moment": "~2.6.0",
    "newrelic": "~1.5.3",
    "node-cryptojs-aes": "~0.4.0",
    "node-highcharts": "0.0.2",
    "node-uuid": "~1.4.1",
    "passport": "~0.2.0",
    "passport-http": "~0.2.2",
    "passport-local": "~1.0.0",
    "password-hash": "~1.2.2",
    "pg": "~3.0.3",
    "restify": "~2.7.0",
    "should": "~3.3.1",
    "socket.io": "~0.9.16",
    "sqlite3": "~2.2.3",
    "util": "~0.10.3",
    "when": "~3.1.0"
  },
  "devDependencies": {
    "grunt": "~0.4.2",
    "grunt-contrib-jshint": "^0.10.0",
    "grunt-mocha-test": "~0.9.0",
    "mocha-phantomjs": "~3.3.1"
  },
  "scripts": {
    "postinstall": "bower install -F"
  },
  "engines": {
    "node": ">=0.6"
  }
}

日志文件

整个日志太长,但如果您需要,我会将其粘贴在多个评论中。下面是唯一提到 bower 的部分。

如果我尝试访问该站点,我可以获得访问日志,表明缺少 bower 组件。

似乎没有执行任何 bower 安装。

/var/log/directory-hooks-executor.log

underscore.string@2.3.3/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string
esprima@1.0.4/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/esprima
object-assign@0.3.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/object-assign
uuid@1.4.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/uuid
最新版本@0.2.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version
package-json@0.2.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json
got@0.3.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got
object-assign@0.3.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/object-assign
registry-url@0.1.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url
npmconf@2.0.2/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf
配置链@1.1.8/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/config-链
proto-list@1.2.3/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/config-链/Node 模块/原型(prototype)列表
ini@1.2.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/ini
继承@2.0.1/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/inherits
mkdirp@0.3.5/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/mkdirp
once@1.3.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/once
uid-number@0.0.5/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/uid-数字
semver-diff@0.1.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/semver-diff
字符串长度@0.1.2/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/string-length
strip-ansi@0.2.2/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/string-length/node_modules/strip-ansi
ansi-regex@0.1.0/tmp/deployment/application/node_modules/bower/node_modules/update-notifier/node_modules/string-length/node_modules/strip-ansi/node_modules/ansi-regex
which@1.0.5/tmp/deployment/application/node_modules/bower/node_modules/which

最佳答案

bower 可能没有全局安装(如果是,请告诉我如何在弹性 beantalk 上安装:D)。
您应该改为指向 node_modules 文件夹中的 bower bin(这是我们过去的做法)。我们已经放弃了该解决方案(以 500 个实例旋转的规模来考虑它......)并正在将 bower_components 检查到 repo 中。

"scripts": {
  "postinstall": "node_modules/bower/bin/bower install -F"
},

关于node.js - AWS - 通过 npm install 安装 bower 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24790972/

相关文章:

Git 标签,为什么 Remote 中有这个重复的标签?

javascript - Npm install `vue@latest` 错误用户代理

javascript - Node.js:如何将全局变量传递到通过 require() 插入的文件中?

node.js - 强制 net/http 使用 c-ares 而不是 getaddrinfo()

git - 压扁的提交是否与其原始提交冲突

node.js - Angularjs 全栈测试

git - 如何显示 Git 存储库子目录的 Git 日志历史记录(即所有相关提交)

angular - 执行 ng update -g @angular/cli 时出现错误

javascript - Carbone JS 与 React JS 的结合使用

javascript - subprocess.on ("exit", () => {}) 如果手动按下 control-c 终止终端则不起作用