Question

Issue


I got the following folder structure:

diaryapp
  nodes_modules
    express
    jade
    mongoose
  public
  routes
  views
  app.js
  package.json

git pushing this to my Joyent Machine will cause a lot of npm errors. I can avoid them by adding mongodb and mongoose to my package.json dependencies, but the service won't start.

I know this is a very small amount of information, if you need further information specify the kind and I ll update my post.


The output:

git push diaryapp.no.de master
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 279 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Deploying node-service.
remote:     revision:  93ce2d3b81592c4c7475c0f242d54429cc511534
remote:     timestamp: 2012-01-23T16-20-45.830922239
remote: Installing node module deps (from package.json).
remote:     
remote:     > mongodb@0.9.8-3 install /home/node/node-service/releases/2012-01-23T16-20-45.830922239/node_modules/mongodb
remote:     > node install.js
remote:     
remote:     ./node_modules/mkdirp -> /home/node/local/lib/node_modules/mkdirp
remote:     ./node_modules/colors -> /home/node/local/lib/node_modules/colors
remote:     ./node_modules/qs -> /home/node/local/lib/node_modules/qs
remote:     ./node_modules/mime -> /home/node/local/lib/node_modules/mime
remote:     ./node_modules/hooks -> /home/node/local/lib/node_modules/hooks
remote:     ./node_modules/connect -> /home/node/local/lib/node_modules/connect
remote:     ================================================================================
remote:     =                                                                              =
remote:     =  To install with C++ bson parser do <npm install mongodb --mongodb:native>   =
remote:     =                                                                              =
remote:     ================================================================================
remote:     ./node_modules/mongodb -> /home/node/local/lib/node_modules/mongodb
remote:     mkdirp@0.0.7 ./node_modules/mkdirp 
remote:     colors@0.5.1 ./node_modules/colors 
remote:     qs@0.4.0 ./node_modules/qs 
remote:     mime@1.2.4 ./node_modules/mime 
remote:     hooks@0.1.9 ./node_modules/hooks 
remote:     connect@1.8.5 ./node_modules/connect 
remote:     mongodb@0.9.8-3 ./node_modules/mongodb 
remote: Starting node-service.
remote: error: Failed to start node server.
remote:     * * * tail of the service log * * *
remote:     [ Jan 23 16:20:51 Executing stop method (:kill). ]
remote:     [ Jan 23 16:20:51 Executing start method ("/opt/nodejs/service-starter"). ]
remote:     0.5.3
remote:     [ Jan 23 16:20:53 Method "start" exited with status 0. ]
remote:     [ Jan 23 16:20:53 Stopping because all processes in service exited. ]
remote:     [ Jan 23 16:20:53 Executing stop method (:kill). ]
remote:     [ Jan 23 16:20:53 Disabled. ]
remote:     * * *
remote: 
remote: Rolling back to default server.
remote: Starting node-service.
remote: Rollback succeeded.
To diaryapp.no.de:repo
   ed1f477..93ce2d3  master -> master

remote: 
remote: 
remote:    uncaught: Error: Cannot find module 'should'
remote:     at Function._resolveFilename (module.js:317:11)
remote:     at Function._load (module.js:262:25)
remote:     at require (module.js:346:19)
remote:     at Object.<anonymous> (/home/node/node-service/releases/2012-01-23T16-32-12.780436389/node_modules/mongoose/test/zzlast.test.js:2:14)
remote:     at Module._compile (module.js:402:26)
remote:     at Object..js (module.js:408:10)
remote:     at Module.load (module.js:334:31)
remote:     at Function._load (module.js:293:12)
remote:     at require (module.js:346:19)
remote:     at runFile (/home/node/node-service/releases/2012-01-23T16-32-12.780436389/node_modules/mongoose/support/expresso/bin/expresso:691:19)
remote: 
remote: 
remote:    Failures: 1
remote: 
remote: 
remote: make: *** [test] Error 1
remote: npm ERR! mongoose@2.4.10 test: `make test`
remote: npm ERR! `sh "-c" "make test"` failed with 2
remote: npm ERR! 
remote: npm ERR! Failed at the mongoose@2.4.10 test script.
remote: npm ERR! This is most likely a problem with the mongoose package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR!     make test
remote: npm ERR! You can get their info via:
remote: npm ERR!     npm owner ls mongoose
remote: npm ERR! There is likely additional logging output above.
remote: npm ERR! 
remote: npm ERR! System SunOS 5.11
remote: npm ERR! command "/opt/nodejs/v0.4/bin/node" "/opt/nodejs/bin/npm" "build" "/home/node/node-service/releases/2012-01-23T16-32-12.780436389" "--npat"
remote: npm ERR! cwd /home/node/node-service/releases/2012-01-23T16-32-12.780436389
remote: npm ERR! node -v v0.4.11
remote: npm ERR! npm -v 1.0.27
remote: npm ERR! 

Solution/Fix


To solve all issues I had to add the devDependencies of mongoose's package.json to the myapp package.json incl. mongoose dependency.

To make this all Joyent SmartMachine node-service ready you have to add

{ "start": "node app.js" }

to your package.json, otherwise node-service does not know which .js to execute as primary.

I will post my entire success story step by step this evening

Was it helpful?

Solution

Since your error is remote: uncaught: Error: Cannot find module 'should' that means you forgot to include the should module as a dependency in package.json.

Ex:

 ...
 "dependencies" : {
   ...
   "should": "0.5.1"
 }
 ...

For more information on package.json checkout: http://package.json.nodejitsu.com/

OTHER TIPS

My solution to this problem: Create a symlink called server.js which links to your application:

ln -s app.js server.js
git commit server.js
git push node master
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top