我尝试使用命令行和webstorm运行它。 早些时候它运行顺利,但现在它已停止工作。 我无法弄清楚错误是什么? 如果我看第13行,它说无法执行启动脚本。 我该如何纠正这个错误?
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/lib/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'run-script',
1 verbose cli 'start' ]
2 info using npm@3.8.3
3 info using node@v4.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle WebDev@0.0.0~prestart: WebDev@0.0.0
6 silly lifecycle WebDev@0.0.0~prestart: no script for prestart, continuing
7 info lifecycle WebDev@0.0.0~start: WebDev@0.0.0
8 verbose lifecycle WebDev@0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle WebDev@0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/vardaan/Projects_Github/WebDev/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle WebDev@0.0.0~start: CWD: /home/vardaan/Projects_Github/WebDev
11 silly lifecycle WebDev@0.0.0~start: Args: [ '-c', 'node ./bin/www' ]
12 silly lifecycle WebDev@0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle WebDev@0.0.0~start: Failed to exec start script
14 verbose stack Error: WebDev@0.0.0 start: `node ./bin/www`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid WebDev@0.0.0
16 verbose cwd /home/vardaan/Projects_Github/WebDev
17 error Linux 3.19.0-58-generic
18 error argv "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run-script" "start"
19 error node v4.4.0
20 error npm v3.8.3
21 error code ELIFECYCLE
22 error WebDev@0.0.0 start: `node ./bin/www`
22 error Exit status 1
23 error Failed at the WebDev@0.0.0 start script 'node ./bin/www'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the WebDev package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node ./bin/www
23 error You can get information on how to open an issue for this project with:
23 error npm bugs WebDev
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls WebDev
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
./bin/www脚本如下
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('WebDev:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}