使用 gatsbyjs 创建网站时遇到问题

Kla*_*awn 2 javascript reactjs gatsby

我使用以下命令安装 Gatsbyjs:

npm install -g gatsby-cli

它安装后,当我尝试创建新站点时,它显示一些错误。

我已经尝试过gastsby new gatsby-site,但它显示了一些错误:

PS C:\Users\Klawnny\Dropbox\ecommerce with React> npm install -g gatsby-cli C:\Users\Klawnny\AppData\Roaming\npm\gatsby -> C:\Users\Klawnny\AppData\Roaming\npm\ node_modules\gatsby-cli\lib\index.js

> gatsby-cli@2.7.53 安装后 C:\Users\Klawnny\AppData\Roaming\npm\node_modules\gatsby-cli > 节点脚本/postinstall.js

+ gatsby-cli@2.7.53 更新了 46.004s PS C:\Users\Klawnny\Dropbox\ecommerce 中的 1 个包,并使用了 React> gatsby new lcoproject

无法加载文件 C:\Users\Klawnny\AppData\Roaming\npm\gatsby.ps1,因为此系统上禁用了脚本执行。请参阅“get-help about_signing”了解更多详细信息。在第 1 行 char:7 + gatsby <<<< new lcoproject + CategoryInfo : NotSpecified: (:) [], PSSecurityException + ExcellentQualifiedErrorId : RuntimeException

我期望它创建该项目,但它显示了这一点。

ram*_*ali 5

如果您使用 VS Code 集成终端,那么简单的终端设置即可解决该问题。

  1. 转到File -> Preferences -> Settings或使用快捷方式Ctrl + ,打开设置
  2. 在搜索栏中,搜索terminal.integrated.shellArgs.windows,然后在结果上单击Edit in settings.json
  3. settings.json然后在文件中添加以下设置"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]