sh:1:bower:部署到herokuapp

时间:2015-10-17 19:26:08

标签: node.js bower package.json

当前的package.json文件:

    {
      "name": "ff-album",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "engines": {
        "node": "0.12.7",
        "npm": "2.11.3"
      },
      "scripts": {
        "postinstall": "node ./node_modules/bower/bin/bower install"
      },
      "author": "",
      "license": "CC",
      "dependencies": {
        "express": "4.13.1",
        "http-server": "^0.8.4",
        "bower": "^1.5.2"
      },
      "devDependencies": {
        "bower": "^1.5.2"
      }
    }

目前的bower.json:

    {
      "name": "ff-album",
      "version": "0.0.0",
      "author": [
        "Francesco Fibonacci"
      ],
      "license": "CC",
      "ignore": [
        "**/.*",
        "node_modules",
        "bower_components",
        "app/vendor",
        "test",
        "tests"
      ],
      "resolutions": {
        "bootstrap": "~3.3.1",
        "angular": ">= 1.0.8",
        "angular-bootstrap": "~0.12.0"
      },
      "dependencies": {
        "angular": "~1.4.6",
        "angular-bootstrap": "~0.13.4",
        "angular-ui-router": "~0.2.15",
        "bootstrap": "~3.3.5",
        "jasny-bootstrap": "~3.1.3",
        "lodash": "~3.10.1",
        "moment": "~2.10.6",
        "swagger-client-generator": "~0.2.13",
        "swagger-js": "~2.1.5"
      }
    }

在部署到herokuapp时,错误消息sh: 1: bower: not found不断出现(我尝试了大约10次)。我按照https://github.com/auth0/auth0.js/issues/12尝试将postinstall更改为bower cache clean && bower install,但无济于事。我也试过npm uninstall -g bower并重新安装了凉亭,但仍然没有运气。

2 个答案:

答案 0 :(得分:19)

您需要将bower添加为依赖项,不仅在devDependencies中,而且在:

"dependencies": {
  "bower": "^1.5.2"
}

答案 1 :(得分:-1)

弄清楚发生了什么!在进行更改以将bower作为依赖项之一时,我没有addcommit package.json。