创建应用:
$ express -c stylus myapp
然后用
npm install && npm start
启动失败,报错:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.1
npm ERR! npm v2.5.1
npm ERR! file C:\Windows\system32\cmd.exe;
npm ERR! path C:\Windows\system32\cmd.exe;
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\Windows\system32\cmd.exe;
npm ERR! myapp@0.0.0 start: `node ./bin/www`
npm ERR! spawn C:\Windows\system32\cmd.exe; ENOENT
npm ERR!
npm ERR! Failed at the myapp@0.0.0 start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls myapp
npm ERR! There is likely additional logging output above.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.1
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! myapp@0.0.0 start: `node ./bin/www`
npm ERR! Exit status -4058
npm ERR!
npm ERR! Failed at the myapp@0.0.0 start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls myapp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\nodeJS\expressStudy\myapp\npm-debug.log
但是使用
node bin/www
则成功运行,请问这是为什么?是不是因为windows cmd
没有ls
命令?
//package.json
{
"name": "myapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.12.0",
"cookie-parser": "~1.3.4",
"debug": "~2.1.1",
"express": "~4.12.2",
"jade": "~1.9.2",
"morgan": "~1.5.1",
"serve-favicon": "~2.2.0",
"stylus": "0.42.3"
}
}
你看看package.json里面有没有 start命令先