node.js - sh : 1: bower: not found error while deploying to herokuapp

标签 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 并重新安装了 bower,但仍然没有成功。

最佳答案

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

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

关于node.js - sh : 1: bower: not found error while deploying to herokuapp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33190674/

相关文章:

javascript - 我可以将基于 Node 的项目迁移到 Deno 吗?

node.js - 在集群架构中横向扩展 RAM?

node.js - Node 应用程序在 Socket.IO 连接后退出

javascript - CryptoJS 与 Bower,如何管理这种依赖性?

javascript - TinyMCE添加到模块后界面消失

node.js - 管理不同环境的 yarn 安装的最佳实践

node.js - Express.js 单选按钮作为使用渲染参数的表单发布方法

node.js - 使用 Express 上传文件失败 : “cannot read property file of undefined”

javascript - 如何阻止 Bower 拉动超出我需要的量?

node.js - NPM 锁定文件无法正确处理传递依赖项