2

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.

6 Answers 6

6

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"]
Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me, I also commented out this code: "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", Thank you very much.
1

This helps me:

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

Bump!!!

Run your Gatsby command again.

Comments

1

I've gotten the same issue a few times. How I fix it on windows 10 with PowerShell:

PS:C:\ Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

more info on Set-ExecutionPolicy

Comments

0

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.

1 Comment

Thanks, but that's for windows 10, and I'm using windows 7
0

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

Comments

-2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.