首先安装命令
npm i -g create-react-app
安装完成后就是创建项目了,命令是:
create-react-app demo (demo是创建的项目名)
此时有个注意点就是创建项目的时候可能会报错
create-react-app : 无法加载文件 C:xxx/xxxxx/xxxx,因为在此系统上禁止运行脚本。有关详细信
息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ create-react-app demo
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
出现这种问题的解决方式是
首先用管理员权限打开PowerShell
在命令行输入set-ExecutionPolicy RemoteSigned,把权限改为A,然后用get-ExecutionPolicy查看状态
完成再输入create-react-app demo (demo是创建的项目名)就完成了