8

有人可以告诉我为什么在 Windows 7 上为基本的平均堆栈应用程序执行 git push heroku master 时出现此错误吗?我正在尝试一个基本的平均堆栈应用程序并执行以下命令,最后执行“git push heroku master”命令导致错误 - bower install
sh: bower: not found, npm ERR!奇怪的错误 127,npm ERR!不行,代码 0,!无法使用 npm 安装 --production 依赖项

cd mean-stack 
npm install
pm install -g bower
npm install -g yo grunt-cli bower@0.9.2
bower install
git init
git add .
git status
git add -f public/lib
git commit -m "init"
heroku create
git push heroku master
 C:\ss\D1\google\04\mean\mean-stack>git push heroku master
    Enter passphrase for key '/c/ss/D1/google/04/eclipse/eclipse/.ssh/id_rsa':
    Counting objects: 466, done.
    Delta compression using up to 4 threads.
Compressing objects: 100% (448/448), done.
Writing objects: 100% (466/466), 8.61 MiB | 522 KiB/s, done.
Total 466 (delta 55), reused 0 (delta 0)

-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.10.15
       Using npm version: 1.2.30
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN package.json mean@1.0.0 No repository field.
       npm http GET https://registry.npmjs.org/express
       npm http GET https://registry.npmjs.org/connect-flash
       npm http GET https://registry.npmjs.org/mongoose
       npm http GET https://registry.npmjs.org/passport
       npm http GET https://registry.npmjs.org/passport-local
....
....
       npm http GET https://registry.npmjs.org/lru-cache
       npm http GET https://registry.npmjs.org/sigmund
       npm http 200 https://registry.npmjs.org/sigmund
       npm http GET https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
       npm http 200 https://registry.npmjs.org/lru-cache
       npm http GET https://registry.npmjs.org/lru-cache/-/lru-cache-2.3.1.tgz
       npm http 200 https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
       npm http 200 https://registry.npmjs.org/lru-cache/-/lru-cache-2.3.1.tgz

       > bson@0.1.8 install /tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson
       > (node-gyp rebuild 2> builderror.log) || (exit 0)


       > kerberos@0.0.3 install /tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
       > (node-gyp rebuild 2> builderror.log) || (exit 0)


       > bson@0.2.2 install /tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson
       > (node-gyp rebuild 2> builderror.log) || (exit 0)

       make: Entering directory `/tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson/build'
         CXX(target) Release/obj.target/bson/ext/bson.o
       make: Entering directory `/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
         CXX(target) Release/obj.target/bson/ext/bson.o
       make: Entering directory `/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
         SOLINK_MODULE(target) Release/obj.target/kerberos.node
         SOLINK_MODULE(target) Release/obj.target/kerberos.node: Finished
         COPY Release/kerberos.node
       make: Leaving directory `/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
         SOLINK_MODULE(target) Release/obj.target/bson.node
         SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
         COPY Release/bson.node
       make: Leaving directory `/tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson/build'
         SOLINK_MODULE(target) Release/obj.target/bson.node
         SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
         COPY Release/bson.node
       make: Leaving directory `/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'

       > mean@1.0.0 postinstall /tmp/build_39luvwq9ok8kb
       > bower install

       sh: bower: not found
       npm ERR! weird error 127
       npm ERR! not ok code 0
 !     Failed to install --production dependencies with npm

 !     Push rejected, failed to compile Node.js app

To git@heroku.com:afternoon-spire-6716.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:afternoon-spire-6716.git'

===========package.json

{
    "name": "mean",
    "description": "Mongo",
    "version": "1.0.0",
    "private": false,
    "author": "MEAN - A Modern Stack: MongoDB, ExpressJS, AngularJS, NodeJS. (BONUS: Passport User Support).",
    "engines": {
        "node": "0.10.x",
        "npm": "1.2.x"
    },
    "scripts": {
        "start": "NODE_ENV=development ./node_modules/.bin/nodemon server.js",
        "test": "NODE_ENV=test ./node_modules/.bin/mocha --reporter spec test/test-*.js",
        "postinstall": "./node_modules/bower/bin/bower install"
    },
    "dependencies": {
        "express": "latest",
        "jade": "latest",
        "mongoose": "latest",
        "connect-mongo": "latest",
        "connect-flash": "latest",
        "passport": "latest",
        "passport-local": "latest",
        "passport-facebook": "latest",
        "passport-twitter": "latest",
        "passport-github": "latest",
        "passport-google-oauth": "latest",
        "underscore": "latest",
        "async": "latest",
        "view-helpers": "latest",
        "mean-logger": "latest"
    },
    "devDependencies": {
        "supertest": "latest",
        "should": "latest",
        "mocha": "latest",
        "bower": "latest",
        "grunt": "~0.4.1",
        "grunt-contrib-compass": "~0.3.0",
        "grunt-contrib-watch": "~0.4.4",
        "grunt-contrib-jshint": "~0.6.0",
        "grunt-nodemon": "0.0.8",
        "grunt-concurrent": "~0.3.0"
    }
}

=========bower.json

{
    "name": "angularJS-IL",
    "version": "1.0.0",
    "dependencies": {
        "bootstrap": "2.3.2",
        "angular": "~1.0.6",
        "angular-resource": "~1.0.6",
        "angular-cookies": "~1.0.6",
        "angular-bootstrap": "~0.4.0",
        "json3": "~3.2.4",
        "jquery": "~1.9.1"
    },
    "devDependencies": {
        "angular-mocks": "~1.0.5",
        "angular-scenario": "~1.0.5"
    }
}

==============.bowerrc

{
    "directory": "public/lib",
    "json": "bower.json"
}
4

2 回答 2

9

您在您中列出了凉亭,devDependencies但在您的dependencies. devDependencies仅安装在开发环境中。

-----> Installing dependencies with npm

因此,当 Heroku 运行npm install其运行的生产环境并且不安装devDeps包括 bower 在内的 . 那是你的问题!

于 2014-04-18T22:29:25.693 回答
-1

我遇到了同样的问题。

从 package.json 文件中的“脚本”依赖项中删除这一行。

"postinstall": "./node_modules/bower/bin/bower install"

https://github.com/isaacs/npm/issues/3609提供

于 2013-08-31T02:51:21.737 回答