当我键入NPM启动时,节点/表示找不到我的应用程序

时间:2014-09-28 15:42:04

标签: node.js

我第一次尝试node.js并且有一些出牙问题。我在w:/nodejs/app/animaltest/package.json安装了express。该应用程序被称为' animalTest'

{
  "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 start'来启动应用时我从命令提示符处得到以下错误。是否存在错误参考?例如'不是OK代码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 npm@1.4.28
3 info using node@v0.10.32
4 verbose node symlink W:\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart animalTest@0.0.0
7 info start animalTest@0.0.0
8 verbose unsafe-perm in lifecycle true
9 info animalTest@0.0.0 Failed to exec start script
10 error animalTest@0.0.0 start: `node ./bin/www`
10 error Exit status 8
11 error Failed at the animalTest@0.0.0 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 ]

1 个答案:

答案 0 :(得分:0)

我必须编辑package.json以反映我的应用程序的位置: - " start":" node nodejs / app / animalTest / bin / www"替换默认的.bin / www

要初始化应用程序,我必须在命令提示符下的animalTest目录中键入npm start

感谢那些评论过的人。