【问题标题】:npm start throws sh: react-scripts: command not foundnpm start 抛出 sh: react-scripts: command not found
【发布时间】:2022-01-26 22:17:26
【问题描述】:

当我重命名一个 react 项目时,然后在 package.json 和 package-lock.json 中更改它的名称,但是当我运行 npm start 命令时,它会抛出以下错误:

sh: react-scripts: command not found

我发现通常可以通过重新安装 node_modules 文件夹来修复该错误。但是当我运行 npm install 时,它会抛出以下错误:

npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! sh: node-gyp-build: command not found

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/manuferreras/.npm/_logs/2022-01-26T13_27_13_876Z-debug.log

有解决办法吗?

【问题讨论】:

  • 尝试删除 node_modules 和 package-lock.json
  • 也不工作。抛出相同的 npm ERR! sh: node-gyp-build: command not found error
  • 删除后试试这个命令:npm cache clean --force
  • 缓存清理出现同样的错误

标签: node.js reactjs npm


【解决方案1】:

使用命令“npm -v”检查 npm 版本?你可能需要重新安装 npm

【讨论】:

  • 8.1.2 ,但我的其他项目工作得很好。唯一的问题是当我重命名项目时
  • 不是anwser,应该是评论。
猜你喜欢
  • 2018-05-30
  • 1970-01-01
  • 2020-01-28
  • 2020-09-26
  • 2016-02-24
  • 2021-09-07
  • 2014-08-10
  • 1970-01-01
  • 2011-12-18
相关资源
最近更新 更多