【问题标题】:Unable to remove global installation of create-react-app无法删除 create-react-app 的全局安装
【发布时间】:2021-03-16 05:39:20
【问题描述】:

我已遵循标准程序(npm uninstall -g create-react-appyarn global remove create-react-app) 删除我之前使用 yarn 全局安装的 create-react-app ,如下面的屏幕截图所示。我还检查了以下目录不存在:/usr/local/bin/create-react-app。

但是,我在使用 npx create-react-app myapp 时仍然收到错误,说我正在运行 create-react-app 4.0.0。

which create-react-app

也不输出任何内容。

因此,我正在寻找解决此问题的方法。

【问题讨论】:

  • 您确定没有将它本地安装在您所在的当前文件夹中吗?
  • 如果可以的话,我想结束我的问题,但我没有足够的代表。由于我已删除此 VM,因此我将无法检查建议的解决方案是否有效。
  • 我已将其标记为版主关闭问题。

标签: reactjs


【解决方案1】:

仔细检查 NPM 缓存:

npm config get cache | xargs ls -tr | grep create-react-app

如果显示什么,删除它:

npm config get cache | xargs ls -tr | grep create-react-app | xargs rm -rf

如果仍然失败,请尝试安装最新的稳定版本:

npm install -g npm@latest

另外,如果 npx 仍然无法使用,请尝试使用 npm

npm create-react-app myapp

【讨论】:

  • 感谢您的回复!不幸的是,我已经删除了我的虚拟机的这个实例并恢复到备份,所以我无法验证这是否有效。
猜你喜欢
  • 2017-09-11
  • 1970-01-01
  • 2020-04-11
  • 2020-04-19
  • 1970-01-01
  • 2020-10-22
  • 2019-09-22
  • 2018-01-14
  • 2018-10-04
相关资源
最近更新 更多