输入命令 create-react-app study_staging 出现问题如下:
PS D:\web\new-staging> create-react-app study_staging
create-react-app : 无法加载文件 C:\Users\TXXX\AppData\Roaming\npm\create-react-app.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ create-react-app study_staging
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解决方案:
我用的是window10 的系统。解决方法:
1、搜索框输入:Windos PowerShell 并且以管理员身份运行,切记一定要用管理员身份运行 要不然下边会报错
2、打开了命令行之后,输入set-ExecutionPolicy RemoteSigned,并且把权限改权限为A
输入命令后
然而又遇到第二个问题:
PS D:\web\new-staging> create-react-app study_staging
& : 无法将“node.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 C:\Users\TXXX\AppData\Roaming\npm\create-react-app.ps1:15 字符: 5
+ & "node$exe" "$basedir/node_modules/create-react-app/index.js" $ar ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (node.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
解决办法: 用管理员身份打开vscode就可以了