【发布时间】:2015-02-03 19:59:27
【问题描述】:
我使用的是 Windows 7,并且我已经安装了 node.js 和 express。 在我使用下面的命令使用 express 创建项目后
> express projectName
创建了一个新项目,然后安装依赖项
> npm install
到目前为止一切正常。但是当我尝试启动应用程序时
> npm start
以下是我在 npm-debug.log 文件中遇到的问题。请建议这里有什么问题。 我尝试了许多其他线程,但找到的解决方案对我有用。
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\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.33
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart NodeTestApp@0.0.0
7 info start NodeTestApp@0.0.0
8 verbose unsafe-perm in lifecycle true
9 info NodeTestApp@0.0.0 Failed to exec start script
10 error NodeTestApp@0.0.0 start: `node ./bin/www`
10 error spawn ENOENT
11 error Failed at the NodeTestApp@0.0.0 start script.
11 error This is most likely a problem with the NodeTestApp 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 NodeTestApp
11 error There is likely additional logging output above.
12 error System Windows_NT 6.1.7601
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd C:\Users\Ali\Desktop\NodeTestApp
15 error node -v v0.10.33
16 error npm -v 1.4.28
17 error syscall spawn
18 error code ELIFECYCLE
19 error errno ENOENT
20 verbose exit [ 1, true ]
【问题讨论】:
-
快速生成的应用程序应该调用
./bin/www而不是app.js。您是否在package.json中更改了此设置?如果您觉得您可能会忽略信息或跳过您采取的步骤。 -
@MatthewBakaitis 是的 ./bin/www 。我将其更改为 app.js,因为我正在学习教程。最初是 ./bin/www ,我更新了上面的结果 > npm start 。看起来几乎一模一样。
标签: windows node.js express npm