Nodejs抛出以下错误

时间:2018-07-28 11:06:21

标签: node.js macos babel restify

我正在使用node运行rest api并在mac-book上进行restify。我不确定为什么会出现以下错误。我尝试更新npm软件包,但无济于事。在此先感谢!

Error: listen EADDRINUSE :::7088
at Server.setupListenHandle [as _listen2] (net.js:1330:14)
at listenInCluster (net.js:1378:12)
at Server.listen (net.js:1465:7)
at Server.listen (/Users/rahul/Development/projects/inventory-manager/node_modules/restify/lib/server.js:404:32)
at spawnWorker (/Users/rahul/Development/projects/inventory-manager/src/server.js:20:10)
at run (/Users/rahul/Development/projects/inventory-manager/src/server.js:81:5)
at Object.<anonymous> (/Users/rahul/Development/projects/inventory-manager/src/server.js:86:1)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at loader (/Users/rahul/Development/projects/inventory-manager/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/rahul/Development/projects/inventory-manager/node_modules/babel-register/lib/node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at Object.<anonymous> (/Users/rahul/Development/projects/inventory-manager/node_modules/babel-cli/lib/_babel-node.js:154:22)
at Module._compile (internal/modules/cjs/loader.js:702:30)
Emitted 'error' event at:
at Server.emit (events.js:182:13)
at Server.EventEmitter.emit (domain.js:442:20)
at emitErrorNT (net.js:1357:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:746:11)
at Object.<anonymous> (/Users/rahul/Development/projects/inventory-manager/node_modules/babel-cli/lib/_babel-node.js:154:22)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
[... lines matching original stack trace ...]
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)
 error: Forever detected script exited with code: 1
 error: Script restart attempt #22
  events.js:167
  throw er; // Unhandled 'error' event
  ^

2 个答案:

答案 0 :(得分:1)

问::为什么我的node进程无法启动?

A:这是您的应用程序即将终止的原因。

  

错误:听EADDRINUSE ::: 7088

这意味着端口7088上已经有另一个进程,而您的node进程无法绑定到它。

答案 1 :(得分:1)

我之前几次遇到这个问题, 只需将节点的端口从7088更改为任何其他端口