我有以下文件夹结构:
diaryapp
nodes_modules
express
jade
mongoose
public
routes
views
app.js
package.json
git将其推送到我的Joyent Machine会导致很多npm错误。 我可以通过在我的package.json依赖项中添加mongodb和mongoose来避免它们,但服务不会启动。
我知道这是一个非常少量的信息,如果您需要进一步的信息指定类型,我会更新我的帖子。
输出:
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!
要解决所有问题,我必须将mongoose的package.json的devDependencies添加到myapp package.json incl。猫鼬依赖。
要使所有Joyent SmartMachine节点服务准备就绪,您必须添加
{ "start": "node app.js" }
到你的package.json,否则node-service不知道哪些.js作为主要执行。
我将在今晚一步一步地发布我的整个成功故事
答案 0 :(得分:1)
由于您的错误为remote: uncaught: Error: Cannot find module 'should'
,这意味着您忘记将should
模块作为依赖项添加到package.json
中。
例如:
...
"dependencies" : {
...
"should": "0.5.1"
}
...
有关package.json checkout的更多信息:http://package.json.nodejitsu.com/
答案 1 :(得分:0)
我对此问题的解决方案:创建一个名为server.js的符号链接,链接到您的应用程序:
ln -s app.js server.js
git commit server.js
git push node master