1
votes

I install Gatsbyjs using:

npm install -g gatsby-cli

It installs and then when I try to create a new site it shows some error.

I have tried gastsby new gatsby-site but it shows some errors:

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

> [email protected] postinstall C:\Users\Klawnny\AppData\Roaming\npm\node_modules\gatsby-cli > node scripts/postinstall.js

+ [email protected] updated 1 package in 46.004s PS C:\Users\Klawnny\Dropbox\ecommerce with react> gatsby new lcoproject

File C:\Users\Klawnny\AppData\Roaming\npm\gatsby.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details. At line:1 char:7 + gatsby <<<< new lcoproject + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException

I expected it to create the project but it shows this.

5

5 Answers

4
votes

if you are using VS Code integrated terminal then a simple terminal setting will solve the issue.

  1. Go to File -> Preferences -> Settings or use shortcut Ctrl + , to open settings
  2. In the serch bar, serach for terminal.integrated.shellArgs.windows, then on the result click on Edit in settings.json
  3. Then add the following setting in settings.json file "terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]
0
votes

Sometimes I got issues running Gatsby on Windows. The way how I solved most of them was installing the Windows Subsystem for Linux. I really recommend you to do the same. The installation is pretty easy, take a look at this.

0
votes

It worked for me by using the powershell integrated console

  • Use the Ctrl+` keyboard shortcut with the backtick character.
  • Use the View > Terminal menu command.
  • From the Command Palette (Ctrl+Shift+P), use the View: Toggle Integrated Terminal command.
  • gastsby new gatsby-site
0
votes

Dude you have a typo. You typed gastsby instead of gatsby. Please be careful with the spellings.

0
votes

This helps me:

  1. Open Windows PowerShell in Administrator mode.
  2. Run Set-ExecutionPolicy RemoteSigned then type Y

Bump!!!

Run your Gatsby command again.