【问题标题】:Brand new react/node.js project wont run on opensuse全新的 react/node.js 项目不会在 opensuse 上运行
【发布时间】:2018-11-04 22:44:02
【问题描述】:

我目前正在学习 Express 和 react,并且最初能够运行 react 应用程序。在启动一个新的网络应用程序时(昨天),我无法阻止一个新创建的反应应用程序崩溃。

My OS:
openSUSE 20180522 <br>
Kernel: x86_64 Linux 4.16.9-1-default

错误:

$ npm start

 > movieapp@0.1.0 start 
 /home/knosence/Templates/syntelBootCamp/react/movieapp
 > react-scripts start

 Attempting to bind to HOST environment variable: linux-gz59
 If this was unintentional, check that you haven't mistakenly set it 
 in your shell.
 Learn more here: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration

 events.js:183
    throw er; // Unhandled 'error' event
    ^

 Error: getaddrinfo ENOTFOUND linux-gz59
     at errnoException (dns.js:50:10)
     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
 npm ERR! movieapp@0.1.0 start: `react-scripts start`
 npm ERR! Exit status 1
 npm ERR! 
 npm ERR! Failed at the movieapp@0.1.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!     /home/knosence/.npm/_logs/2018-05-24T20_48_01_951Z- 
 debug.log

`

$ cat /home/knosence/.npm/_logs/2018-05-24T20_48_01_951Z-debug.log<br> 
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node8', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.0.1
3 info using node@v8.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle movieapp@0.1.0~prestart: movieapp@0.1.0
6 info lifecycle movieapp@0.1.0~start: movieapp@0.1.0
7 verbose lifecycle movieapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle movieapp@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/knosence/Templates/syntelBootCamp/react/movieapp/node_modules/.bin:/home/knosence/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin:/snap/bin
9 verbose lifecycle movieapp@0.1.0~start: CWD: /home/knosence/Templates/syntelBootCamp/react/movieapp
10 silly lifecycle movieapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle movieapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle movieapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: movieapp@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid movieapp@0.1.0
15 verbose cwd /home/knosence/Templates/syntelBootCamp/react/movieapp
16 verbose Linux 4.16.9-1-default
17 verbose argv "/usr/bin/node8" "/usr/local/bin/npm" "start"
18 verbose node v8.11.2
19 verbose npm  v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error movieapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the movieapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

`

如果有人能帮我解决这个问题,我们将不胜感激!!如果有人需要更多信息,请告诉我,我会提供。谢谢!

【问题讨论】:

标签: node.js reactjs express react-native npm


【解决方案1】:

我遇到了同样的问题并使用

修复了它
HOST=localhost npm start

希望对其他人有所帮助!

【讨论】:

    【解决方案2】:

    你的机器可能有一个全局的 HOST 环境变量,所以 Create React App 会尝试在它上面找到一个开放的端口,而不是默认的 localhost。删除环境变量,它应该可以正常工作。

    也许这个答案会对你有所帮助。

    Create-react-app error

    【讨论】:

      猜你喜欢
      • 2017-10-23
      • 2019-10-19
      • 1970-01-01
      • 2017-01-14
      • 2012-04-14
      • 1970-01-01
      • 2021-08-16
      • 2012-07-08
      • 2014-05-10
      相关资源
      最近更新 更多