2017-09-29 329 views
0

我想開始作出反應的js服務器通過使用命令「故宮開始」但它顯示在控制檯下面的錯誤:我使用NPM 5.3.0和節點陣營的js服務器啓動失敗

[email protected]:~/WebstormProjects/untitled> npm start 

> [email protected] start /home/prateek/WebstormProjects/untitled 
> react-scripts start 

Could not find an open port at localhost.localdomain. 
Network error message: getaddrinfo ENOTFOUND localhost.localdomain 

npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
npm ERR! [email protected] start: `react-scripts start` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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!  /home/prateek/.npm/_logs/2017-09-29T05_33_18_507Z-debug.log 

Linux上的8.4.0。

下NPM日誌文件:

0 info it worked if it ends with ok 
1 verbose cli [ '/usr/bin/node8', '/usr/bin/npm-default', 'start' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'prestart', 'start', 'poststart' ] 
5 info lifecycle [email protected]~prestart: [email protected] 
6 info lifecycle [email protected]~start: [email protected] 
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true 
8 verbose lifecycle [email protected]~start: PATH: /usr/lib64/node_modules/npm8/bin/node-gyp-bin:/home/prateek/WebstormProjects/untitled/node_modules/.bin:/usr/lib64/mpi/gcc/openmpi/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin 
9 verbose lifecycle [email protected]~start: CWD: /home/prateek/WebstormProjects/untitled 
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ] 
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null 
12 info lifecycle [email protected]~start: Failed to exec start script 
13 verbose stack Error: [email protected] start: `react-scripts start` 
13 verbose stack Exit status 1 
13 verbose stack  at EventEmitter.<anonymous> (/usr/lib64/node_modules/npm8/lib/utils/lifecycle.js:289:16) 
13 verbose stack  at emitTwo (events.js:125:13) 
13 verbose stack  at EventEmitter.emit (events.js:213:7) 
13 verbose stack  at ChildProcess.<anonymous> (/usr/lib64/node_modules/npm8/lib/utils/spawn.js:40:14) 
13 verbose stack  at emitTwo (events.js:125:13) 
13 verbose stack  at ChildProcess.emit (events.js:213:7) 
13 verbose stack  at maybeClose (internal/child_process.js:927:16) 
13 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 
14 verbose pkgid [email protected] 
15 verbose cwd /home/prateek/WebstormProjects/untitled 
16 verbose Linux 4.11.8-2-default 
17 verbose argv "/usr/bin/node8" "/usr/bin/npm-default" "start" 
18 verbose node v8.4.0 
19 verbose npm v5.3.0 
20 error code ELIFECYCLE 
21 error errno 1 
22 error [email protected] start: `react-scripts start` 
22 error Exit status 1 
23 error Failed at the [email protected] start script. 
23 error This is probably not a problem with npm. There is likely additional logging output above. 
24 verbose exit [ 1, true ] 

是否有人可以告訴我,我該如何解決這個問題?

+0

'找不到localhost.localdomain上的開放端口.' –

+0

代碼會很好。 –

+0

@Kevin B其實,localhost是pc的名字。 –

回答

-1

看起來好像別的東西正在開發端口上運行(端口3000)。運行命令sudo lsof -n -i :3000 | grep LISTEN,然後關閉正在使用該端口的程序或使用sudo kill {PID}(將{PID}替換爲使用第一個命令找到的PID)。

+0

我運行這個命令,但沒有進程在這個端口上運行。 –

+0

嘗試使用'sudo react-scripts start' –