【问题标题】:Can not run 'npm start' ReactJS无法运行“npm start”ReactJS
【发布时间】:2018-05-25 07:36:38
【问题描述】:

我是 ReactJS 和 Yeoman 生成器的新手。所以我有一个问题,因为当我用这个命令生成项目时

  1. npm install -g 哟
  2. npm install -g generator-react-webpack
  3. yo react-webpack

然后我设置项目名称,使用 css,并启用 postcss。 当我尝试使用推荐时 npm start # 或 npm run serve

  1. npm 运行服务

    @0.0.1 服务 C:\Users\user\Desktop\ProjectReact 节点 server.js --env=dev

    events.js:183
          throw er; // Unhandled 'error' event
          ^
    
    Error: listen EACCES 127.0.0.1:8000
        at Object._errnoException (util.js:992:11)
        at _exceptionWithHostPort (util.js:1014:20)
        at Server.setupListenHandle [as _listen2] (net.js:1338:19)
        at listenInCluster (net.js:1396:12)
        at GetAddrInfoReqWrap.doListen [as callback] (net.js:1505:7)
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! @0.0.1 serve: `node server.js --env=dev`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the @0.0.1 serve 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!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-05-25T07_27_23_660Z-debug.log
    

【问题讨论】:

  • 端口已经被占用,如果你正在运行windows,那么检查任务管理器并结束所有节点进程。
  • 哦,是的,太简单了,谢谢!

标签: node.js reactjs npm yeoman


【解决方案1】:

您在 server.js 文件中用于运行节点应用程序的端口是 8000,该端口已被占用,并且其他进程正在其上运行。

您可以终止 8000 端口上当前正在运行的进程,也可以将 server.js 文件中的端口更改为 8000 端口以外的其他端口。并再次尝试运行。

【讨论】:

    猜你喜欢
    • 2021-01-25
    • 1970-01-01
    • 2019-11-28
    • 2017-10-05
    • 2020-06-23
    • 2020-09-23
    • 1970-01-01
    • 2021-10-03
    • 2020-02-05
    相关资源
    最近更新 更多