新版create-react-app无法安装项目怎么办?

589 阅读1分钟

当我们执行npx create-react-app my-app时,出现了以下提示:

image.png 这个时候添加版本号即可解决:

npx create-react-app@5.0.0 my-app

typescript:

npx create-react-app@5.0.0 my-app --template typescript

如果带上版本号依然无法下载

image.png 只需要更新Node版本即可,建议Node 16+版本。
Node官网:  nodejs.org/zh-cn/ image.png

如果更新Node版本还存在无法安装怎么办?

我们只需要清除缓存,然后重新安装:

npx clear-npx-cache
npx create-react-app@5.0.0 my-app

封面: 齐藤飞鸟