【问题标题】:How to solve "npm ERR! code ELIFECYCLE" in react?如何在反应中解决“npm ERR!code ELIFECYCLE”?
【发布时间】:2020-08-25 22:49:31
【问题描述】:

当我尝试在我的 react 应用程序中运行 npm start 时,我收到了这个错误:

$ npm start

> trends@0.1.0 start C:\Users\Administrateur.TEST\Desktop\reactProjects\trends
> react-scripts start

'react-scripts' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! trends@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the trends@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!     C:\Users\Administrateur.TEST\AppData\Roaming\npm-cache\_logs\2020-07-20T07_09_04_578Z-debug.log

我尝试了其他解决方案,例如使用清理缓存、删除 node_modules 并再次运行 npm install,但仍然得到相同的错误

【问题讨论】:

  • 你能添加你正在使用的create-react-app的版本吗
  • @Yassine,根据 create-react-app 文档,不要使用 npm install -g create-react-app 下载 create-react-app 而是直接使用 npx create-react-app 运行它
  • 是的,我一开始就是这么做的

标签: javascript node.js reactjs npm


【解决方案1】:

我建议做这三个步骤:

  1. npm install -g npm@latest 更新 npm,因为它有时是错误的。
  2. 删除项目中的node_modules 文件夹。
  3. npm install 重新安装项目依赖项。

【讨论】:

    【解决方案2】:

    我通过在 PATH SYSTEM VARIABLES 中添加 C:\Windows\System32\ 来解决问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-18
      • 2020-12-27
      • 1970-01-01
      • 2019-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多