[英]running both client and server side issue
我試圖運行客戶端和服務器端應用程序但尚未成功。 基本上我在我的客戶端應用程序(reactjs)上運行構建,然后將所有文件從構建文件夾復制到服務器端工作所在的客戶端/構建文件夾。 一切正常,直到我對客戶端工作進行了一些更改,並重建和更新了服務器文件夾。 我不太確定有關的錯誤消息...這是我的錯誤日志
[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
錯誤的關鍵是這一行: Error: listen EADDRINUSE :::3000
這意味着當你運行npm run start-server
,已經有一個服務器正在運行並監聽該端口。 您的react開發服務器是否在與服務器相同的端口(3000)上運行?
如果您有相當新版本的macOS,可以使用此命令檢查端口3000上運行的是什么: lsof -nP -i4TCP:3000 | grep LISTEN
lsof -nP -i4TCP:3000 | grep LISTEN
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.