1、搭建Nexus私服,并建立npm仓库
2、局域网内npm和yarn的registry设置成Nexus私服的npm仓库地址
//获取npm的registry
npm config get registry
//设置npm的registry,http地址替换为npm仓库地址
npm config set registry=http://localhost:8081/repository/npm-public/
//获取yarn的registry
yarn config get registry
//设置yarn的registry,http地址替换为npm仓库地址
yarn config set registry=http://localhost:8081/repository/npm-public/
3、安装npx,命令行内输入以下内容
npm install -g npx
4、空文件夹内执行yarn add操作
注意:此步骤不可省略。在某个空文件夹内执行以下操作,否则WebStorm不能正确创建creat-react-app,yarn会提示离线
yarn add react react-dom react-scripts
5、WebStorm使用create-react-app
删除第4步骤操作生成的内容,运行WebStorm即可在任意文件夹下生成creat-react-app程序。