Failed to rebuild dependencies with npm

simo picture simo · May 22, 2013 · Viewed 9k times · Source

As I am trying to push my nodejs app which is working fine locally to heroku, here is what I get in terminal:

dcaclab@ubuntu:~/RubymineProjects/nodejs_consumer$ git push heroku master
Counting objects: 1417, done.
Compressing objects: 100% (1195/1195), done.
Writing objects: 100% (1417/1417), 2.02 MiB | 22 KiB/s, done.
Total 1417 (delta 247), reused 0 (delta 0)

-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.10.6
       Using npm version: 1.2.21
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No readme data.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] 'repositories' (plural) Not supported.
       npm WARN package.json Please pick one as the 'repository' field
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No readme data.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] 'repositories' (plural) Not supported.
       npm WARN package.json Please pick one as the 'repository' field
       npm WARN package.json [email protected] No repository field.

       > [email protected] install /tmp/build_f86ikz343m5u/node_modules/dnode/node_modules/weak
       > node-gyp rebuild

       gyp http GET http://nodejs.org/dist/v0.10.6/node-v0.10.6.tar.gz
       gyp http 200 http://nodejs.org/dist/v0.10.6/node-v0.10.6.tar.gz
       make: Entering directory `/tmp/build_f86ikz343m5u/node_modules/dnode/node_modules/weak/build'
         CXX(target) Release/obj.target/weakref/src/weakref.o
         SOLINK_MODULE(target) Release/obj.target/weakref.node
         SOLINK_MODULE(target) Release/obj.target/weakref.node: Finished
         COPY Release/weakref.node
       make: Leaving directory `/tmp/build_f86ikz343m5u/node_modules/dnode/node_modules/weak/build'

       > [email protected] install /tmp/build_f86ikz343m5u/node_modules/shoe/node_modules/sockjs/node_modules/rbytes
       > node-waf configure build

       sh: node-waf: not found
       npm ERR! weird error 127
       npm ERR! not ok code 0
 !     Failed to rebuild dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

To [email protected]:dcaclab-simulator.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:dcaclab-simulator.git'

here is my package.json file:

{
  "name": "node-example",
  "version": "0.0.1",
  "dependencies": {
    "dnode": "1.0.5",
    "shoe": "0.0.10"
  },
  "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
  }
}

Any idea please?

EDIT

Tried to use node 0.8, here is what I got:

dcaclab@ubuntu:~/RubymineProjects/nodejs_consumer$ git push heroku master
Counting objects: 1420, done.
Compressing objects: 100% (1198/1198), done.
Writing objects: 100% (1420/1420), 2.02 MiB | 24 KiB/s, done.
Total 1420 (delta 249), reused 0 (delta 0)

-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.8.23
       Using npm version: 1.2.21
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No readme data.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] 'repositories' (plural) Not supported.
       npm WARN package.json Please pick one as the 'repository' field
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No readme data.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] No repository field.
       npm WARN package.json [email protected] 'repositories' (plural) Not supported.
       npm WARN package.json Please pick one as the 'repository' field

       > [email protected] install /tmp/build_1uw8vrtz5u7yu/node_modules/dnode/node_modules/weak
       > node-gyp rebuild

       gyp http GET http://nodejs.org/dist/v0.8.23/node-v0.8.23.tar.gz
       gyp http 200 http://nodejs.org/dist/v0.8.23/node-v0.8.23.tar.gz
       make: Entering directory `/tmp/build_1uw8vrtz5u7yu/node_modules/dnode/node_modules/weak/build'
         CXX(target) Release/obj.target/weakref/src/weakref.o
         SOLINK_MODULE(target) Release/obj.target/weakref.node
         SOLINK_MODULE(target) Release/obj.target/weakref.node: Finished
         COPY Release/weakref.node
       make: Leaving directory `/tmp/build_1uw8vrtz5u7yu/node_modules/dnode/node_modules/weak/build'

       > [email protected] install /tmp/build_1uw8vrtz5u7yu/node_modules/shoe/node_modules/sockjs/node_modules/rbytes
       > node-waf configure build

       Checking for program g++ or c++          : /usr/bin/g++ 
       Checking for program cpp                 : /usr/bin/cpp 
       Checking for program ar                  : /usr/bin/ar 
       Checking for program ranlib              : /usr/bin/ranlib 
       Checking for g++                         : ok  
       Checking for node path                   : not found 
       Checking for node prefix                 : ok /tmp/node-node-Rkll 
       'configure' finished successfully (0.027s)
       Waf: Entering directory `/home/dcaclab/RubymineProjects/nodejs_consumer/node_modules/shoe/node_modules/sockjs/node_modules/rbytes/build'
       Waf: Leaving directory `/home/dcaclab/RubymineProjects/nodejs_consumer/node_modules/shoe/node_modules/sockjs/node_modules/rbytes/build'
       Traceback (most recent call last):
         File "/tmp/node-node-Rkll/bin/node-waf", line 16, in <module>
           Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
           prepare_impl(t, cwd, ver, wafdir)
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
           main()
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
           fun(ctx)
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
           return build_impl(bld)
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
           bld.compile()
         File "/tmp/node-node-Rkll/bin/../lib/node/wafadmin/Build.py", line 268, in compile
           os.chdir(self.bldnode.abspath())
       OSError: [Errno 2] No such file or directory: '/home/dcaclab/RubymineProjects/nodejs_consumer/node_modules/shoe/node_modules/sockjs/node_modules/rbytes/build'
       npm ERR! weird error 1
       npm ERR! not ok code 0
 !     Failed to rebuild dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

To [email protected]:dcaclab-simulator.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:dcaclab-simulator.git'

Answer

Peter Lyons picture Peter Lyons · May 22, 2013

So the rbytes package has been unchanged for 2 years, and in that time node has switched from the node-waf build system to node-gyp. As of node v0.10.0, node-waf is no longer included thus the sh: node-waf: not found error message. I think you have a few options (in order of preference):

  1. Use a more modern module instead of rbytes
  2. Convince the author of rbytes to update to support recent node and release a new version
  3. Fork rbytes and fix it yourself
  4. Set your package.json engine to node 0.8 and try again

EDIT

Well, error message #2 still looks like rbytes doesn't build properly. I'd have to dig into that package particularly to understand the error. Not sure how/why it's working for you locally but having problems on heroku, but I think it's time for the rbytes maintainer to do some maintenance.