尝试运行这个命令:
npx clear-npx-cache
已经解决了。我执行了npx create-react-app@5.0.0 my-app
命令。
参考:创建新的React应用时出错(“您正在运行的是 `create-react-app` 4.0.3,它已落后于最新版本(5.0.0)”)
npx clear-npx-cache
。 - Michael Fultonnpx create-react-app@latest my-app
来解决这个问题。 - lucky-brucenpx clear-npx-cache
对我很有用。
尝试使用 npx clear-npx-cache
清除您的 npx 缓存,然后运行命令 npx create-react-app your-app
创建应用程序。
此外,也许值得尝试强制使用最新版本:
npx create-react-app@latest my-app --use-npm
问题已解决。通过使用以下代码:
npx create-react-app@5.0.0 my-app
如果不起作用,请按照以下步骤再试一次:
从C:\Users\your_pc_name\AppData\Roaming\npm-
cache删除所有内容。
这可能是本地缓存问题。在终端中使用管理员模式尝试命令npm cache clean --force
,然后再次尝试执行相同的命令- npx create-react-app my-app
。
按照以下步骤操作:
npm卸载 -g create-react-app
npm cache clean --force
npm cache verify
npx create-react-app my-app
您正在运行 create-react-app
4.0.3 版本,该版本已经落后于最新版 (5.0.0)。
我们不再支持全局安装 Create React App。
以下命令可行--npx create-react-app@5.0.0 my-app
npx clear-npx-cache
对我也起作用了。 - saurabhshcs
npm uninstall -g create-react-app
- Brandon