简体   繁体   English

同时运行客户端和服务器端问题

[英]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. 基本上我在我的客户端应用程序(reactjs)上运行构建,然后将所有文件从构建文件夹复制到服务器端工作所在的客户端/构建文件夹。 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. 错误的关键是这一行: Error: listen EADDRINUSE :::3000这意味着当你运行npm run start-server ,已经有一个服务器正在运行并监听该端口。 Is your react development server running on the same port (3000) as your server? 您的react开发服务器是否在与服务器相同的端口(3000)上运行?

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 如果您有相当新版本的macOS,可以使用此命令检查端口3000上运行的是什么: lsof -nP -i4TCP:3000 | grep LISTEN lsof -nP -i4TCP:3000 | grep LISTEN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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