旧版本 create-react-app 导致创建工程失败

 

 

 创建的工程文件只有一下三个文件(夹):
node_modules, package.json, yarn.lock。

解决方案:

1、npm uninstall -g create-react-app
2、
执行命令 create-react-app --version 显示出版本号,则说明没有删除 create-react-app
执行 which create-react-app 
出现 /usr/local/bin/create-react-app
执行 rm -rf /usr/local/bin/create-react-app 
删除create-react-app
3、
npx create-react-app my-app

 

4、安装成功之后还会出现

    command not found: create-react-app  

  则需要全局安装 yarn global add create-react-app 

5、执行初始化命令

create-react-app demo —scripts-version @wenzai/react-scripts

posted @ 2020-08-10 10:14  小饿爽  阅读(458)  评论(0编辑  收藏  举报