【问题标题】:After creating my react app using "npx create-react-app my-app," npm start is throwing me an ELIFECYCLE error. What do? [duplicate]在使用“npx create-react-app my-app”创建我的反应应用程序后,npm start 向我抛出了一个 ELIFECYCLE 错误。做什么? [复制]
【发布时间】:2019-08-14 14:30:06
【问题描述】:

我正在阅读官方的 react 教程并希望使用我自己的文本编辑器;所以我按照他们的指示一直到我通过“npx create-react-app my-app”创建我的应用程序的地步。之后,当我运行命令“npm start”时,我得到以下信息:

(base) Benjamins-MacBook-Pro:my-app solidiquis$ npm start
 my-app@0.1.0 start /Users/solidiquis/Desktop/my-app
 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.
Learn more here: **omitted
events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND x86_64-apple-darwin13.4.0
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26)
Emitted 'error' event at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1440:12)    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@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!     /Users/solidiquis/.npm/_logs/2019-03-23T20_04_34_120Z-debug.log
(base) Benjamins-MacBook-Pro:my-app solidiquis$ 

我已经卸载并重新安装了节点倍数;我还尝试在我的项目的根目录中添加一个 .env 文件,如下所述: npm start on new create-react-app build returns ELIFECYCLE error,但无济于事。任何帮助将不胜感激!

【问题讨论】:

    标签: node.js reactjs


    【解决方案1】:

    对我来说,这是因为 HOST 变量设置为“x86_64-apple-darwin13.4.0”。这里的步骤帮助我修复了它:https://medium.com/@choy/fixing-create-react-app-when-npm-fails-to-start-because-your-host-environment-variable-is-being-4c8a9fa0b461

    【讨论】:

      【解决方案2】:

      它很奇怪,但对我有用

      前往

      控制面板-->系统和安全-->系统-->高级系统 安全性--> 环境变量

      在环境变量弹出窗口中,您将编辑用户变量 PATH 并将 "C:\Windows\System32" 值添加为 分号分隔 到现有值。

      不重启机器。

      【讨论】:

        猜你喜欢
        • 2021-11-27
        • 2022-10-20
        • 1970-01-01
        • 2020-01-21
        • 1970-01-01
        • 1970-01-01
        • 2022-01-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多