简体   繁体   中英

running both client and server side issue

Im trying to run both client side and server side app yet not successful. Basically I run build on my client-side app(reactjs) then copied all the files from build folder to client/build folder where the server side work is located. Everything was working until I did some changes on the client side work and rebuild and updated the server folder. Im not quite sure what the error message about ... Here is my the error log

[0] > node app.js
[0] 
[0] (node:2907) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
[0] events.js:167
[0]       throw er; // Unhandled 'error' event
[0]       ^
[0] 
[0] Error: listen EADDRINUSE :::3000
[0]     at Server.setupListenHandle [as _listen2] (net.js:1286:14)
[0]     at listenInCluster (net.js:1334:12)
[0]     at Server.listen (net.js:1421:7)
[0]     at Object.<anonymous> (/Users/guest/Desktop/work/copy/finfine/app.js:180:8)
[0]     at Module._compile (internal/modules/cjs/loader.js:688:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
[0]     at Module.load (internal/modules/cjs/loader.js:598:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[0]     at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
[0]     at startup (internal/bootstrap/node.js:285:19)
[0]     at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
[0] Emitted 'error' event at:
[0]     at emitErrorNT (net.js:1313:8)


   [0]     at process._tickCallback (internal/process/next_tick.js:63:19)
    [0]     at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    [0]     at startup (internal/bootstrap/node.js:285:19)
    [0]     at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
    [0] npm ERR! code ELIFECYCLE
    [0] npm ERR! errno 1
    [0] npm ERR! finfine@1.0.0 start-server: `node app.js`
    [0] npm ERR! Exit status 1
    [0] npm ERR! 
    [0] npm ERR! Failed at the finfine
@1.0.0 start-server script.
    [0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    [0] 
    [0] npm ERR! A complete log of this run can be found in:
    [0] npm ERR!     /Users/guest/.npm/_logs/2019-03-26T00_43_54_435Z-debug.log
    [0] npm run start-server exited with code 1
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! finfine@1.0.0 start: `concurrently "npm run start-server"`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the finfine@1.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/guest/.npm/_logs/2019-03-26T00_43_54_468Z-debug.log

The crux of the error is this line: Error: listen EADDRINUSE :::3000 This means that when you ran npm run start-server , there was already a server running and listening on that port. Is your react development server running on the same port (3000) as your server?

If you have a fairly recent version of macOS, you can use this command to check what's running on port 3000: lsof -nP -i4TCP:3000 | grep LISTEN lsof -nP -i4TCP:3000 | grep LISTEN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM