8

Can some please advise why I'm getting this error when doing a git push heroku master on windows 7 for a basic mean stack app? I'm trying a basic mean stack app and did the following commands and finally "git push heroku master" command which resulted in the error - bower install
sh: bower: not found, npm ERR! weird error 127, npm ERR! not ok code 0, ! Failed to install --production dependencies with npm

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"
}
PrairieProf
  • 174
  • 11
user2712585
  • 153
  • 1
  • 2
  • 5

2 Answers2

9

You have bower listed in you devDependencies but not in your dependencies. devDependencies are only installed in the development environment.

-----> Installing dependencies with npm

So when Heroku runs npm install its running the production environment and is not installing the devDeps, including bower. Thats your issue!

Jim Hall
  • 6,079
  • 2
  • 16
  • 15
-1

I was running into the same issue.

Remove this line from your "scripts" dependency in your package.json file.

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

courtesy of https://github.com/isaacs/npm/issues/3609

Richard Kuo
  • 750
  • 6
  • 9