我在第一次嘗試node.js並遇到一些初始問題。我已經在w:/nodejs/app/animaltest/package.json上安裝了express。該應用程序被稱爲「animalTest」當我鍵入NPM start時,節點/表示找不到我的應用程序
{
"name": "animalTest",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"express": "~4.9.0",
"body-parser": "~1.8.1",
"cookie-parser": "~1.3.3",
"morgan": "~1.3.0",
"serve-favicon": "~2.1.3",
"debug": "~2.0.0",
"hjs": "~0.0.6",
"less-middleware": "1.0.x"
}
}
當我嘗試鍵入「NPM啓動」我從命令提示符下錯誤啓動應用程序。有錯誤的參考嗎?例如'不好的代碼0'不是很有幫助。
0 info it worked if it ends with ok
1 verbose cli [ 'W:\\nodejs\\\\node.exe',
1 verbose cli 'W:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink W:\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 info [email protected] Failed to exec start script
10 error [email protected] start: `node ./bin/www`
10 error Exit status 8
11 error Failed at the [email protected] start script.
11 error This is most likely a problem with the animalTest package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error node ./bin/www
11 error You can get their info via:
11 error npm owner ls animalTest
11 error There is likely additional logging output above.
12 error System Windows_NT 6.1.7601
13 error command "W:\\nodejs\\\\node.exe" "W:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd W:\nodejs\app\animalTest
15 error node -v v0.10.32
16 error npm -v 1.4.28
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]
請顯示您的package.json。另外,您確定express軟件包位於node_modules文件夾中嗎? – 2014-09-28 15:43:54
yes express位於我animalTest(應用程序名稱)目錄中的node_modules文件夾中。 – imnew123 2014-09-28 15:46:31
嗯,運行'node ./bin/www'時會發生問題。嘗試直接在命令行中運行,看看會發生什麼。另外,如果'www'是一個JavaScript文件,則必須包含文件擴展名。 – 2014-09-28 15:48:50