webpack / react-starter

[OUTDATED] Starter template for React with webpack. Doesn't focus on simplicity! NOT FOR BEGINNERS!
2.21k stars 320 forks source link

Can't start dev server #34

Closed TheSisb closed 9 years ago

TheSisb commented 9 years ago

I keep getting errors.

Ran npm install to begin:

m03:react-starter-master thesisb$ npm install
npm WARN package.json react-starter@0.0.0 No repository field.

When I try starting it:

m03:react-starter-master thesisb$ npm run start-dev

> react-starter@0.0.0 start-dev /Users/thesisb/Websites/react-starter-master
> node lib/server-development

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: listen EADDRINUSE
    at exports._errnoException (util.js:746:11)
    at Server._listen2 (net.js:1129:14)
    at listen (net.js:1155:10)
    at Server.listen (net.js:1240:5)
    at EventEmitter.app.listen (/Users/thesisb/Websites/react-starter-master/node_modules/express/lib/application.js:559:24)
    at module.exports (/Users/thesisb/Websites/react-starter-master/lib/server.js:143:6)
    at Object.<anonymous> (/Users/thesisb/Websites/react-starter-master/lib/server-development.js:1:82)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "start-dev"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.0
npm ERR! code ELIFECYCLE
npm ERR! react-starter@0.0.0 start-dev: `node lib/server-development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-starter@0.0.0 start-dev script 'node lib/server-development'.
npm ERR! This is most likely a problem with the react-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/server-development
npm ERR! You can get their info via:
npm ERR!     npm owner ls react-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thesisb/Websites/react-starter-master/npm-debug.log
m03:react-starter-master thesisb$

The contents of the file it tells me to include:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'start-dev' ]
2 info using npm@2.5.0
3 info using node@v0.12.0
4 verbose run-script [ 'prestart-dev', 'start-dev', 'poststart-dev' ]
5 info prestart-dev react-starter@0.0.0
6 info start-dev react-starter@0.0.0
7 verbose unsafe-perm in lifecycle true
8 info react-starter@0.0.0 Failed to exec start-dev script
9 verbose stack Error: react-starter@0.0.0 start-dev: `node lib/server-development`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack     at EventEmitter.emit (events.js:110:17)
9 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:14:12)
9 verbose stack     at ChildProcess.emit (events.js:110:17)
9 verbose stack     at maybeClose (child_process.js:1008:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
10 verbose pkgid react-starter@0.0.0
11 verbose cwd /Users/thesisb/Websites/react-starter-master
12 error Darwin 14.0.0
13 error argv "node" "/usr/local/bin/npm" "run" "start-dev"
14 error node v0.12.0
15 error npm  v2.5.0
16 error code ELIFECYCLE
17 error react-starter@0.0.0 start-dev: `node lib/server-development`
17 error Exit status 1
18 error Failed at the react-starter@0.0.0 start-dev script 'node lib/server-development'.
18 error This is most likely a problem with the react-starter package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node lib/server-development
18 error You can get their info via:
18 error     npm owner ls react-starter
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
FoxxMD commented 9 years ago

You're trying to start the server on a port that is already in use. Try changing the default port in lib\server-development.js to something other than 8080.

masudshrabon commented 9 years ago

Yes, I have also faced the same problem while command : .

npm run dev
Thanks to @FoxxMD . Its a problem on the port, nothing else.

I have other program that works on port 8080. webpack-dev-server also wants to use that port by default. So I have just change the port number from 8080 to 8081 (can be anything valid other) in the _ProjectFolder \node_modules\webpack-dev-server\bin\webpack-dev-server.js_ file.

Anothe solution is that you can stop that program working on port 8080.

Thank you :)

viviannow commented 8 years ago

I met the same proble and thaks to @masudshrabon ,his comment is so useful.

bluehenry commented 8 years ago

Same issue and resolved it by changing port number in ProjectFolder \node_modules\webpack-dev-server\bin\webpack-dev-server.js file. @masudshrabon Thanks!

honeyjie commented 7 years ago

very help ,change the port then it will be good

aniruddhashevle commented 7 years ago

This is due to port 8080 is in used already. So you can change your development server port which is not in used at the same time.

To change it using CLI, webpack-dev-server --hot --port=8081

Or add 'port': '8081' in your webpack JS file as follows,

'devServer': {
  ...
  'port': '8081',
  ...
}
saikirankv commented 7 years ago

can you guys change the error message, like try another port..

laushinka commented 7 years ago

@saikirankv The line "Error: listen EADDRINUSE" actually says exactly that. EADDRINUSE means that the port number is already in use.

samayo commented 7 years ago

same error, but I have no server running