npm今天启动失败,并出现以下错误

时间:2018-06-25 05:06:34

标签: node.js reactjs npm

今天当我在react上测试代码时,我无法启动开发服务器,并且错误显示为打击。

  

material@2.0.0开始/用户/ linyujie /文件/软件配置文件/源代码/成功管理反应   npm运行serve:dev

> material@2.0.0 serve:dev /Users/linyujie/Files/Softprofiles/SourceCode/successmanagerreact
> webpack-dev-server --host 0.0.0.0 --port 3000 --open --env dev

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:3000
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1351:14)
    at listenInCluster (net.js:1392:12)
    at doListen (net.js:1501:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:678:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! material@2.0.0 serve:dev: `webpack-dev-server --host 0.0.0.0 --port 3000 --open --env dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the material@2.0.0 serve:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/linyujie/.npm/_logs/2018-06-25T04_55_36_232Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! material@2.0.0 start: `npm run serve:dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the material@2.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/linyujie/.npm/_logs/2018-06-25T04_55_36_255Z-debug.log

2 个答案:

答案 0 :(得分:2)

端口3000正在使用。尝试使用netstat查找使用该端口的进程的PID。如果不需要,请停止/终止该过程。该链接对于windows可能是方便的,对于mac来说,它是方便的,以查找在端口上监听的进程。

答案 1 :(得分:1)

错误提示:Error: listen EADDRINUSE 0.0.0.0:3000,表示当前有一个使用相同IP和端口0.0.0.0:3000的应用程序。如果不确定使用哪个应用程序,则可以尝试关闭所有命令提示符并仅启动您的应用程序。