全新的react / node.js项目不会在opensuse上运行

时间:2018-05-25 13:53:18

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

我目前正在学习Express并立即做出反应,并且最初能够运行react app。在启动新的Web应用程序(昨天)时,我无法阻止新创建的反应应用程序崩溃。

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 ]

`

如果有人可以帮助我,那将非常感谢!!如果有人需要更多信息,请告诉我,我会提供。谢谢!

2 个答案:

答案 0 :(得分:0)

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

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

Create-react-app error

答案 1 :(得分:0)

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

进行了修复
import pandas as pd
path = r'C:\Temp\tmp.csv'
trg = open(path, 'w')
trg.write('col1,col2\n')
for i in range(10**6):
    trg.write('{0},{1}\n'.format(i, i*2))
trg.close()
df = pd.read_csv(path, skiprows=10**5, nrows=30)

希望对其他人有帮助!