Having Problems creating a site with gatsbyjs - javascript

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
> gatsby-cli#2.7.53 postinstall
C:\Users\Klawnny\AppData\Roaming\npm\node_modules\gatsby-cli > node
scripts/postinstall.js
+ gatsby-cli#2.7.53 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.

if you are using VS Code integrated terminal then a simple terminal setting will solve the issue.
Go to File -> Preferences -> Settings or use shortcut Ctrl + , to open settings
In the serch bar, serach for terminal.integrated.shellArgs.windows, then on the result click on Edit in settings.json
Then add the following setting in settings.json file "terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]

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.

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

This helps me:
Open Windows PowerShell in Administrator mode.
Run Set-ExecutionPolicy RemoteSigned then type Y
Bump!!!
Run your Gatsby command again.

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

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

Related

React Native, Failed to launch emulator. Reason: No emulators found as an output

I'm trying to run my react native app in emulator by using command react-native run-android but it's throwing that error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 44s
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync /Opt/Android/platform-tools/adb ENOENT
info Starting the app...
The system cannot find the path specified.
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: Command failed: /Opt/Android/platform-tools/adb shell am start -n com.reactproject/com.reactproject.MainActivity
at makeError (C:\Users\Danger World\ReactProject\node_modules\execa\index.js:174:9)
I already setup my android studio and sdk manager, avd manager like it's shown in doc also I already set path but it's still showing that error, anyone know why? Can anyone help please?
You can fix it by using the command :
react-native doctor
This command shows all issues that need to be fixed.
Press f to fix the issues and don't forget to restart your windows
And after then open the emulator before running your project.
Once emulator opened,
run command:
react-native run-android
After fixed:
Don't forget to give me an upvote if that's work.
In My Case, I have to re-run the command in the same terminal where you are trying to run npx react-native run-android
Step 1. paste the source command first
source ~/.bash_profile OR source ~/.bashrc
Step 2. RUN Next command
npx react-native run-android
set your AVD manager path and JDK path like this , also you have to add Android Home path

(PERCY) Warning: skipping visual tests. PERCY_TOKEN was not provided

I'm getting this error below everytime I try to run 'npx percy exec -- node snapshots.js'.
PowerShell Terminal
Problem Image ->
https://i.stack.imgur.com/XCSj6.png
I have followed this Tutorial -> https://docs.percy.io/docs/percyscript-tutorial
Anyone know how to solve this? I looked everywhere and found nothing.
Thank you in advance!
PowerShell has a different syntax for working with Environment Variables.
Try this:
$env:PERCY_TOKEN = "token"
Powershell Help - About Environment Variables
To set up PERCY_TOKEN on windows we have to use powershell.
1.Open powershell on windows
2. Go to project library through commands cd, cd..
3.Set the PERCY_TOKEN $env:PERCY_TOKEN='your token'
4. Then run your project using powershell through your command npm run test:percy

Big error when trying to set up Github pages

Trying to set up project on github pages, but during following steps from
here
at step 2 I getting this error from images
Any idea?
I working on Win7
with NPM 5.6.0
Node 8.11.3
It seems you need to run as administrator, like so: sudo npm install --save gh-pages.
Or if you'd running on Windows could be:
right-click on CLI icon
open as administrator
Perform your command (now you're administrator)
The error you're getting indicates you need to elevate your shell's permission.
Use your environment's equivalent of sudo/"Run as Administrator" to grant the proper access to perform the functions required to install.

EPERM: operation not permitted, lstat when running ng build

I'm getting an ERROR when trying to run ng build on my angular 4 app.
EPERM: operation not permitted, lstat '<dist directory>'
Has anyone encountered this issue?
TIA
I had the same problem.
As #Mauricio De La Quintana said, the problem is permission.
In my case (Windows environment), I solved the problem by removing the read-only property from the Repos folder and adding write permission to the Everyone user.
This probably a permission issue, just restart your IDE with admin permissions!
In my case I had to restart VsCode as administrator.
While running npm run build - I received error
Open Task Manager -> Select Chrome - > End Task
-> Select VSCode -> End Task
Opened the Project again -> Run npm run Build ---> worked for me
This has happened in my ASP.NET projects. For me this has happened for one of two reasons.
This can be a permission problem so you need to run Command Prompt as Admin.
a. Press win to open the start menu. Type in cmd to search for Command Prompt.
b. Press ctrl + shift + enter to launch Command Prompt as administrator.
This can happen when you build your web project in Visual Studio(or another IDE) and it is currently running.
a. This is a simple fix click the stop debugging and then try 'ng build' again.
Just restarted the VSCode and ran in admin. That solves my problem.
I saw this problem when running IISNODE...
Solution: Ensure that AppPool Identify from IIS has read permissions all the way from root of harddrive to website files.
Full answer is here https://github.com/tjanczuk/iisnode/issues/247
I had this issue while running a build on windows at the same time WSL was running in the directory. The issue was resolved by closing the WSL terminal.
Simply follow these steps
Restart VS Code
run npm run build
I think it is a permission problem, when you do ng build you also delete the previous files. I suggest using
sudo chown -R youruser /pathAngularApp
I had the same problem, and it was related to what #goku_da_master commented, I had the vueJs application running even when my VsCode stopped, I figured it out from the task manager and fixed it like this:
I opened the task manager
I searched if Node.js was running
Right click on the Node.js process
Finish Task
"npm run dev" again
I experienced the same problem. The fix for me was to install the correct node version that the project was requiring (an older one), then closing all terminal windows in VS Code, and relaunching VSC.
To switch node versions, I installed nvm and had to make sure the default alias was pointing towards the exact node version I wanted.
Error : Error: EPERM: operation not permitted, lstat 'C:\Users\Administrator'
We encountered this error after the Windows update.
This Solution worked for me;
Go to C:\Users\Administrator
Rename the file NTUSER.DAT as NTUSER-old.DAT

Meteor js Windows install error "Failed to contact install server"

I have tried running the install with "Run as Admin" feature on windows too, but the same issue persists.
I see this question has been posted before but still no resolution given.
Basically the following error message comes in the middle of the install and the install stops. Please help.
Error message:
"Failed to contact install server. Please try again later."
Check if you have Node js already installed before installing meteorjs other wise it crashes on Windows sometimes hope it helped.
https://nodejs.org/en/download/
Install meteor with this installer: https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows
If you are behind a proxy set these parameters HTTP_PROXY and HTTPS_PROXY: Using Meteor behind a proxy
Update your meteor installation: meteor update
The meteor will be updated to the last version.
install from https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows (the >60MB file) and set the user.meteor folder in your path
the problem with windows installation is too long pathnames (>256) so better try a linux VM

Categories