npm start on new create-react-app build返回ELIFECYCLE错误

问题描述 投票:0回答:3

使用create-react-app创建了一个新的反应应用程序,现在在运行npm start时在终端中收到以下错误:

> react-scripts start

Attempting to bind to HOST environment variable: x86_64-apple-darwin13.4.0
If this was unintentional, check that you haven't mistakenly set it in your shell.


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

Error: getaddrinfo ENOTFOUND x86_64-apple-darwin13.4.0
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
Emitted 'error' event at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1468:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:17)
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!     /Users/chris/.npm/_logs/2018-12-24T10_07_46_970Z-debug.log 

尝试删除node-module文件夹和npm install。

reactjs macos npm terminal
3个回答
3
投票

在终端输入unset HOST。它将解决这个问题。


0
投票

我能够通过运行npm install create-react-app而不是npm install -g create-react-app来修复类似的错误。希望能帮助到你。


© www.soinside.com 2019 - 2024. All rights reserved.