我正在尝试使用 appfog 免费服务器学习 node.js,所以这是我的 app.js 文件:
var http = require("http");
var url = require("url");
console.log('asd');
function start(route) {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
route(pathname);
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello pd!!!");
response.end();
}
http.createServer(onRequest).listen(process.env.VMC_APP_PORT || 1337, null);
}
包.json
{
"name":"hello-node",
"version":"0.0.1",
"dependencies":{
"express":""
}
}
npm-shrinkwrap.json
{
"name": "npm",
"version": "1.3.1",
"dependencies": {
"semver": {
"version": "2.0.8",
"from": "semver@latest"
},
"ini": {
"version": "1.1.0",
"from": "ini@latest"
},
"slide": {
"version": "1.1.4",
"from": "slide@latest"
},
"abbrev": {
"version": "1.0.4",
"from": "abbrev@latest"
},
"graceful-fs": {
"version": "1.2.2",
"from": "graceful-fs@latest"
},
"minimatch": {
"version": "0.2.12",
"from": "minimatch@latest",
"dependencies": {
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz"
}
}
},
"nopt": {
"version": "2.1.1",
"from": "nopt@latest"
},
"rimraf": {
"version": "2.2.0",
"from": "rimraf@2.2"
},
"request": {
"version": "2.21.0",
"from": "request@latest",
"dependencies": {
"qs": {
"version": "0.6.5",
"from": "qs@~0.6.0"
},
"json-stringify-safe": {
"version": "4.0.0",
"from": "json-stringify-safe@~4.0.0"
},
"forever-agent": {
"version": "0.5.0",
"from": "forever-agent@~0.5.0"
},
"tunnel-agent": {
"version": "0.3.0",
"from": "tunnel-agent@~0.3.0"
},
"http-signature": {
"version": "0.9.11",
"from": "http-signature@~0.9.11",
"dependencies": {
"assert-plus": {
"version": "0.1.2",
"from": "assert-plus@0.1.2"
},
"asn1": {
"version": "0.1.11",
"from": "asn1@0.1.11"
},
"ctype": {
"version": "0.5.2",
"from": "ctype@0.5.2"
}
}
},
"hawk": {
"version": "0.13.1",
"from": "hawk@~0.13.0",
"dependencies": {
"hoek": {
"version": "0.8.5",
"from": "hoek@0.8.x"
},
"boom": {
"version": "0.4.2",
"from": "boom@0.4.x",
"dependencies": {
"hoek": {
"version": "0.9.1",
"from": "hoek@0.9.x",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
}
}
},
"cryptiles": {
"version": "0.2.1",
"from": "cryptiles@0.2.x"
},
"sntp": {
"version": "0.2.4",
"from": "sntp@0.2.x",
"dependencies": {
"hoek": {
"version": "0.9.1",
"from": "hoek@0.9.x",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
}
}
}
}
},
"aws-sign": {
"version": "0.3.0",
"from": "aws-sign@~0.3.0"
},
"oauth-sign": {
"version": "0.3.0",
"from": "oauth-sign@~0.3.0"
},
"cookie-jar": {
"version": "0.3.0",
"from": "cookie-jar@~0.3.0"
},
"node-uuid": {
"version": "1.4.0",
"from": "node-uuid@~1.4.0"
},
"mime": {
"version": "1.2.9",
"from": "mime@~1.2.9"
},
"form-data": {
"version": "0.0.8",
"from": "form-data@0.0.8",
"dependencies": {
"combined-stream": {
"version": "0.0.4",
"from": "combined-stream@~0.0.4",
"dependencies": {
"delayed-stream": {
"version": "0.0.5",
"from": "delayed-stream@0.0.5"
}
}
},
"async": {
"version": "0.2.9",
"from": "async@~0.2.7"
}
}
}
}
},
"which": {
"version": "1.0.5",
"from": "which@1"
},
"tar": {
"version": "0.1.17",
"from": "tar@0.1.17",
"resolved": "https://registry.npmjs.org/tar/-/tar-0.1.17.tgz"
},
"fstream": {
"version": "0.1.22",
"from": "fstream@latest"
},
"block-stream": {
"version": "0.0.6",
"from": "block-stream@*"
},
"inherits": {
"version": "1.0.0",
"from": "git://github.com/isaacs/inherits"
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@0.3.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
},
"read": {
"version": "1.0.4",
"from": "read@~1.0.3",
"dependencies": {
"mute-stream": {
"version": "0.0.3",
"from": "mute-stream@~0.0.2"
}
}
},
"lru-cache": {
"version": "2.3.0",
"from": "lru-cache@latest"
},
"node-gyp": {
"version": "0.10.2",
"from": "node-gyp@latest"
},
"fstream-npm": {
"version": "0.1.4",
"from": "fstream-npm@latest",
"dependencies": {
"fstream-ignore": {
"version": "0.0.6",
"from": "fstream-ignore@~0.0.5"
}
}
},
"uid-number": {
"version": "0.0.3",
"from": "../uid-number"
},
"archy": {
"version": "0.0.2",
"from": "archy@0.0.2"
},
"chownr": {
"version": "0.0.1",
"from": "../chownr"
},
"npmlog": {
"version": "0.0.3",
"from": "npmlog@latest"
},
"ansi": {
"version": "0.1.2",
"from": "ansi@~0.1.2"
},
"npm-registry-client": {
"version": "0.2.25",
"from": "npm-registry-client@latest",
"dependencies": {
"couch-login": {
"version": "0.1.17",
"from": "couch-login@~0.1.15"
}
}
},
"read-package-json": {
"version": "1.1.0",
"from": "read-package-json@1",
"dependencies": {
"normalize-package-data": {
"version": "0.2.0",
"from": "normalize-package-data@~0.2",
"dependencies": {
"github-url-from-git": {
"version": "1.1.1",
"from": "github-url-from-git@~1.1.1"
}
}
}
}
},
"read-installed": {
"version": "0.2.2",
"from": "read-installed@latest"
},
"glob": {
"version": "3.2.1",
"from": "glob@3.2.1",
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.1.tgz"
},
"init-package-json": {
"version": "0.0.10",
"from": "init-package-json@latest",
"dependencies": {
"promzard": {
"version": "0.2.0",
"from": "promzard@~0.2.0"
}
}
},
"osenv": {
"version": "0.0.3",
"from": "osenv@latest"
},
"lockfile": {
"version": "0.3.4",
"from": "lockfile@0.3.4",
"resolved": "https://registry.npmjs.org/lockfile/-/lockfile-0.3.4.tgz"
},
"retry": {
"version": "0.6.0",
"from": "retry"
},
"once": {
"version": "1.1.1",
"from": "once"
},
"npmconf": {
"version": "0.1.1",
"from": "npmconf@latest",
"dependencies": {
"config-chain": {
"version": "1.1.7",
"from": "config-chain@~1.1.1",
"dependencies": {
"proto-list": {
"version": "1.2.2",
"from": "proto-list@~1.2.1"
}
}
}
}
},
"opener": {
"version": "1.3.0",
"from": "opener@latest"
},
"chmodr": {
"version": "0.1.0",
"from": "chmodr@latest"
},
"cmd-shim": {
"version": "1.1.0",
"from": "cmd-shim@"
},
"sha": {
"version": "1.0.1",
"from": "sha@~1.0.1"
},
"editor": {
"version": "0.0.4",
"from": "editor@"
},
"child-process-close": {
"version": "0.1.1",
"from": "child-process-close@",
"resolved": "https://registry.npmjs.org/child-process-close/-/child-process-close-0.1.1.tgz"
},
"npm-user-validate": {
"version": "0.0.3",
"from": "npm-user-validate@0.0.3",
"resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.0.3.tgz"
}
}
}
当我尝试使用更新我的应用程序af update ikap
时,它给了我很多错误
Error: Application [ikap] failed to start, logs information below.
====> /logs/staging.log <====
# Logfile created on 2013-07-06 17:48:46 +0000 by logger.rb/25413
Installing dependencies. Node version 0.8.14
Installing semver@semver@latest from local path
Installing ini@ini@latest from local path
Installing slide@slide@latest from local path
Installing abbrev@abbrev@latest from local path
Installing graceful-fs@graceful-fs@latest from local path
Installing minimatch@minimatch@latest from local path
Installing sigmund@sigmund@~1.0.0 from local path
Installing nopt@nopt@latest from local path
Installing rimraf@rimraf@2.2 from local path
Installing request@request@latest from local path
Installing qs@qs@~0.6.0 from local path
Installing json-stringify-safe@json-stringify-safe@~4.0.0 from local path
Installing forever-agent@forever-agent@~0.5.0 from local path
Installing tunnel-agent@tunnel-agent@~0.3.0 from local path
Installing http-signature@http-signature@~0.9.11 from local path
Installing assert-plus@assert-plus@0.1.2 from local path
Installing asn1@asn1@0.1.11 from local path
Installing ctype@ctype@0.5.2 from local path
Installing hawk@hawk@~0.13.0 from local path
Installing hoek@hoek@0.8.x from local path
Installing boom@boom@0.4.x from local path
Installing hoek@hoek@0.9.x from local path
Installing cryptiles@cryptiles@0.2.x from local path
Installing sntp@sntp@0.2.x from local path
Installing hoek@hoek@0.9.x from local path
Installing aws-sign@aws-sign@~0.3.0 from local path
Installing oauth-sign@oauth-sign@~0.3.0 from local path
Installing cookie-jar@cookie-jar@~0.3.0 from local path
Installing node-uuid@node-uuid@~1.4.0 from local path
Installing mime@mime@~1.2.9 from local path
Installing form-data@form-data@0.0.8 from local path
Installing combined-stream@combined-stream@~0.0.4 from local path
Installing delayed-stream@delayed-stream@0.0.5 from local path
Installing async@async@~0.2.7 from local path
Installing which@which@1 from local path
Installing tar@tar@0.1.17 from local path
Installing fstream@fstream@latest from local path
Installing block-stream@block-stream@* from local path
Installing inherits@git://github.com/isaacs/inherits from git source
Installing mkdirp@mkdirp@0.3.5 from local path
Installing read@read@~1.0.3 from local path
Installing mute-stream@mute-stream@~0.0.2 from local path
Installing lru-cache@lru-cache@latest from registry
Package is not found in npm registry lru-cache@lru-cache@latest
Failed getting the requested package: lru-cache@lru-cache@latest
Installing node-gyp@node-gyp@latest from registry
Package is not found in npm registry node-gyp@node-gyp@latest
Failed getting the requested package: node-gyp@node-gyp@latest
Installing fstream-npm@fstream-npm@latest from registry
Package is not found in npm registry fstream-npm@fstream-npm@latest
Failed getting the requested package: fstream-npm@fstream-npm@latest
Installing uid-number@../uid-number from registry
Package is not found in npm registry uid-number@../uid-number
Failed getting the requested package: uid-number@../uid-number
Installing archy@archy@0.0.2 from registry
Package is not found in npm registry archy@archy@0.0.2
Failed getting the requested package: archy@archy@0.0.2
Installing chownr@../chownr from registry
Package is not found in npm registry chownr@../chownr
Failed getting the requested package: chownr@../chownr
Installing npmlog@npmlog@latest from registry
Package is not found in npm registry npmlog@npmlog@latest
Failed getting the requested package: npmlog@npmlog@latest
Installing ansi@ansi@~0.1.2 from registry
Package is not found in npm registry ansi@ansi@~0.1.2
Failed getting the requested package: ansi@ansi@~0.1.2
Installing npm-registry-client@npm-registry-client@latest from registry
Package is not found in npm registry npm-registry-client@npm-registry-client@lat
est
Failed getting the requested package: npm-registry-client@npm-registry-client@la
test
Installing read-package-json@read-package-json@1 from registry
Package is not found in npm registry read-package-json@read-package-json@1
Failed getting the requested package: read-package-json@read-package-json@1
Installing read-installed@read-installed@latest from registry
Package is not found in npm registry read-installed@read-installed@latest
Failed getting the requested package: read-installed@read-installed@latest
Installing glob@glob@3.2.1 from registry
Package is not found in npm registry glob@glob@3.2.1
Failed getting the requested package: glob@glob@3.2.1
Installing init-package-json@init-package-json@latest from registry
Package is not found in npm registry init-package-json@init-package-json@latest
Failed getting the requested package: init-package-json@init-package-json@latest
Installing osenv@osenv@latest from registry
Package is not found in npm registry osenv@osenv@latest
Failed getting the requested package: osenv@osenv@latest
Installing lockfile@lockfile@0.3.4 from registry
Package is not found in npm registry lockfile@lockfile@0.3.4
Failed getting the requested package: lockfile@lockfile@0.3.4
Installing retry@retry from registry
Package is not found in npm registry retry@retry
Failed getting the requested package: retry@retry
Installing once@once from registry
Package is not found in npm registry once@once
Failed getting the requested package: once@once
Installing npmconf@npmconf@latest from registry
Package is not found in npm registry npmconf@npmconf@latest
Failed getting the requested package: npmconf@npmconf@latest
Installing opener@opener@latest from registry
Package is not found in npm registry opener@opener@latest
Failed getting the requested package: opener@opener@latest
Installing chmodr@chmodr@latest from registry
Package is not found in npm registry chmodr@chmodr@latest
Failed getting the requested package: chmodr@chmodr@latest
Installing cmd-shim@cmd-shim@ from registry
Package is not found in npm registry cmd-shim@cmd-shim@
Failed getting the requested package: cmd-shim@cmd-shim@
Installing sha@sha@~1.0.1 from registry
Package is not found in npm registry sha@sha@~1.0.1
Failed getting the requested package: sha@sha@~1.0.1
Installing editor@editor@ from registry
Package is not found in npm registry editor@editor@
Failed getting the requested package: editor@editor@
Installing child-process-close@child-process-close@ from registry
Package is not found in npm registry child-process-close@child-process-close@
Failed getting the requested package: child-process-close@child-process-close@
Installing npm-user-validate@npm-user-validate@0.0.3 from registry
Package is not found in npm registry npm-user-validate@npm-user-validate@0.0.3
Failed getting the requested package: npm-user-validate@npm-user-validate@0.0.3
====> /logs/stdout.log <====
asd
据我了解,这是因为我的 nodejs 缺少一些软件包,所以我一个一个地安装它们(第一次成功安装是因为我安装了其中一些)。但是当我试图npm shrinkwrap
:
C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap>npm shrinkwrap
npm ERR! Error: Problems were encountered
npm ERR! Please correct and try again.
npm ERR! extraneous: archy@0.0.2 C:\nodejs\node_modules\npm\test\packages\npm-te
st-shrinkwrap\node_modules\archy
npm ERR! extraneous: child-process-close@0.1.1 C:\nodejs\node_modules\npm\test\p
ackages\npm-test-shrinkwrap\node_modules\child-process-close
npm ERR! extraneous: chmodr@0.1.0 C:\nodejs\node_modules\npm\test\packages\npm-t
est-shrinkwrap\node_modules\chmodr
npm ERR! extraneous: cmd-shim@1.1.0 C:\nodejs\node_modules\npm\test\packages\npm
-test-shrinkwrap\node_modules\cmd-shim
npm ERR! extraneous: editor@0.0.4 C:\nodejs\node_modules\npm\test\packages\npm-t
est-shrinkwrap\node_modules\editor
npm ERR! extraneous: lockfile@0.3.4 C:\nodejs\node_modules\npm\test\packages\npm
-test-shrinkwrap\node_modules\lockfile
npm ERR! extraneous: npm-user-validate@0.0.3 C:\nodejs\node_modules\npm\test\pac
kages\npm-test-shrinkwrap\node_modules\npm-user-validate
npm ERR! extraneous: npmlog@0.0.3 C:\nodejs\node_modules\npm\test\packages\npm-t
est-shrinkwrap\node_modules\npmlog
npm ERR! extraneous: opener@1.3.0 C:\nodejs\node_modules\npm\test\packages\npm-t
est-shrinkwrap\node_modules\opener
npm ERR! extraneous: read-installed@0.2.2 C:\nodejs\node_modules\npm\test\packag
es\npm-test-shrinkwrap\node_modules\read-installed
npm ERR! extraneous: retry@0.6.0 C:\nodejs\node_modules\npm\test\packages\npm-te
st-shrinkwrap\node_modules\retry
npm ERR! extraneous: sax@0.5.4 C:\nodejs\node_modules\npm\test\packages\npm-test
-shrinkwrap\node_modules\sax
npm ERR! extraneous: sha@1.0.1 C:\nodejs\node_modules\npm\test\packages\npm-test
-shrinkwrap\node_modules\sha
npm ERR! extraneous: uid-number@0.0.3 C:\nodejs\node_modules\npm\test\packages\n
pm-test-shrinkwrap\node_modules\uid-number
npm ERR! extraneous: block-stream@0.0.6 C:\nodejs\node_modules\npm\test\packages
\npm-test-shrinkwrap\node_modules\block-stream
npm ERR! extraneous: fstream-npm@0.1.4 C:\nodejs\node_modules\npm\test\packages\
npm-test-shrinkwrap\node_modules\fstream-npm
npm ERR! extraneous: glob@3.2.1 C:\nodejs\node_modules\npm\test\packages\npm-tes
t-shrinkwrap\node_modules\glob
npm ERR! extraneous: init-package-json@0.0.10 C:\nodejs\node_modules\npm\test\pa
ckages\npm-test-shrinkwrap\node_modules\init-package-json
npm ERR! extraneous: npm-registry-client@0.2.25 C:\nodejs\node_modules\npm\test\
packages\npm-test-shrinkwrap\node_modules\npm-registry-client
npm ERR! extraneous: registry@0.3.0 C:\nodejs\node_modules\npm\test\packages\npm
-test-shrinkwrap\node_modules\registry
npm ERR! extraneous: node-gyp@0.10.2 C:\nodejs\node_modules\npm\test\packages\np
m-test-shrinkwrap\node_modules\node-gyp
npm ERR! extraneous: npmconf@0.1.1 C:\nodejs\node_modules\npm\test\packages\npm-
test-shrinkwrap\node_modules\npmconf
npm ERR! at shrinkwrap_ (C:\nodejs\node_modules\npm\lib\shrinkwrap.js:29:15)
npm ERR! at C:\nodejs\node_modules\npm\lib\shrinkwrap.js:23:5
npm ERR! at C:\nodejs\node_modules\npm\lib\ls.js:41:30
npm ERR! at C:\nodejs\node_modules\npm\node_modules\read-installed\read-inst
alled.js:119:5
npm ERR! at C:\nodejs\node_modules\npm\node_modules\read-installed\read-inst
alled.js:233:14
npm ERR! at cb (C:\nodejs\node_modules\npm\node_modules\slide\lib\async-map.
js:48:11)
npm ERR! at C:\nodejs\node_modules\npm\node_modules\read-installed\read-inst
alled.js:233:14
npm ERR! at cb (C:\nodejs\node_modules\npm\node_modules\slide\lib\async-map.
js:48:11)
npm ERR! at C:\nodejs\node_modules\npm\node_modules\read-installed\read-inst
alled.js:233:14
npm ERR! at cb (C:\nodejs\node_modules\npm\node_modules\slide\lib\async-map.
js:48:11)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "shrinkwrap"
npm ERR! cwd C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap
npm ERR! node -v v0.10.12
npm ERR! npm -v 1.3.1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap\npm-de
bug.log
npm ERR! not ok code 0
另外, npm install
C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap>npm install
npm http GET https://registry.npmjs.org/tar/-/tar-0.1.17.tgz
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http GET https://registry.npmjs.org/child-process-close/-/child-process-clos
e-0.1.1.tgz
npm http GET https://registry.npmjs.org/lockfile/-/lockfile-0.3.4.tgz
npm http GET https://registry.npmjs.org/glob/-/glob-3.2.1.tgz
npm http GET https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.
0.3.tgz
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "install"
npm ERR! cwd C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap
npm ERR! node -v v0.10.12
npm ERR! npm -v 1.3.1
npm ERR! code ENOGIT
npm http 200 https://registry.npmjs.org/tar/-/tar-0.1.17.tgz
npm http 200 https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.
0.3.tgz
npm http 200 https://registry.npmjs.org/glob/-/glob-3.2.1.tgz
npm http 200 https://registry.npmjs.org/child-process-close/-/child-process-clos
e-0.1.1.tgz
npm http 200 https://registry.npmjs.org/lockfile/-/lockfile-0.3.4.tgz
npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\nodejs\node_modules\npm\test\packages\npm-test-shrinkwrap\npm-de
bug.log
npm ERR! not ok code 0
我只想逐步学习node.js,但我什至无法将我的第一个文件上传到appfog ...