Klawn
Klawn

Reputation: 21

Having Problems creating a site with gatsbyjs

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.

Upvotes: 2

Views: 2828

Answers (6)

Blake Abbott
Blake Abbott

Reputation: 11

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

Upvotes: 1

nhaht
nhaht

Reputation: 1227

This helps me:

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

Bump!!!

Run your Gatsby command again.

Upvotes: 1

Cadet Hasib
Cadet Hasib

Reputation: 47

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

Upvotes: -2

ramzan ali
ramzan ali

Reputation: 501

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"]

Upvotes: 6

Ofek S.
Ofek S.

Reputation: 49

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

Upvotes: 0

Gian Marco Ferrara
Gian Marco Ferrara

Reputation: 1

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.

Upvotes: 0

Related Questions