Search code examples
node.jsreactjsnpmyeoman

Can not run 'npm start' ReactJS


I'm new in ReactJS nad Yeoman generator. Soo I have a problem, becasue when I generate project with this command

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

Then I set up project name, use css, and enable postcss. When I try to use commend npm start # or npm run serve

  1. npm run serve

    @0.0.1 serve C:\Users\user\Desktop\ProjectReact node 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
    

Solution

  • The port you are using to run the node application in your server.js file is 8000 which is already taken and some other process is running on it.

    You can either kill the current running process on 8000 port or change the port in your server.js file to something else than 8000 port. and try running again.