发表于2014-03-23 20:09:19
1 2 3 | mkdir my-node-app cd my-node-app npm init |
1 | npm install domready --save |
1 2 3 | "dependencies" : { "domready" : "^1.0.4" } |
1 2 3 | "scripts" : { "start" : "node index.js" } |
1 2 3 | "scripts" : { "test" : "mocha" } |
1 | echo node_modules >> .gitignore |
1 | heroku config: set npm_config_registry=http: //registry .npmjs |
1 2 3 4 5 6 7 8 9 10 11 | cd my-node-app npm outdated Package Current Wanted Latest Location ------- ------- ------ ------ -------- express 3.4.8 3.4.8 4.0.0-rc2 express jade 1.1.5 1.1.5 1.3.0 jade cors 2.1.1 2.1.1 2.2.0 cors jade 0.26.3 0.26.3 1.3.0 mocha > jade diff 1.0.7 1.0.7 1.0.8 mocha > diff glob 3.2.3 3.2.3 3.2.9 mocha > glob commander 2.0.0 2.0.0 2.1.0 mocha > commander |
1 2 3 4 5 6 7 8 9 10 | { "name" : "my-node-app" , "version" : "1.2.3" , "scripts" : { "preinstall" : "echo here it comes!" , "postinstall" : "echo there it goes!" , "start" : "node index.js" , "test" : "tap test/*.js" } } |
1 2 3 4 5 6 7 8 | { "scripts" : { "postinstall" : "npm run build && npm run rejoice" , "build" : "grunt" , "rejoice" : "echo yay!" , "start" : "node index.js" } } |
1 2 3 4 5 6 7 8 | { "scripts" : { "start" : "node --harmony index.js" }, "engines" : { "node" : "0.11.x" } } |
译者:renyuzhuo
转自:http://ourjs.com/detail/53272b83cc7e181509000003
原文:https://blog.heroku.com/archives/2014/3/11/node-habits?utm_source=nodeweekly&utm_medium=email#6-use-environment-variables-to-configure-npm&utm_source=ourjs.com