【发布时间】: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 -
缓存清理出现同样的错误