Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

expo version command shows running scripts disabled on this machine

I am trying to develop a react native project in my Windows 10 machine. I installed node js then expo cli via visual studio code terminal. Then I tried the command expo --version, the terminal shows error::

expo : File C:\Users\saka\AppData\Roaming\npm\expo.ps1 cannot be loaded because running scripts is disabled on this system. For more 
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ expo --version
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

the given link shows many things, but what shall I do to solve my problem? Thank You!!!

like image 590
user4221591 Avatar asked Feb 26 '20 09:02

user4221591


People also ask

How do you fix error ps1 Cannot be loaded because running scripts is disabled on this system in react?

ps1 cannot be loaded because running scripts is disabled on this system" occurs when the execution policy does not allow running the specific script on Windows. Use the Set-ExecutionPolicy -ExecutionPolicy RemoteSigned command to solve the error.


9 Answers

Just try to open Windows PowerShell run as administrator and then run this command line:

Set-ExecutionPolicy RemoteSigned
like image 180
phearakthefoundry Avatar answered Oct 12 '22 23:10

phearakthefoundry


Step1 : start power shell in administrator mode.

Step2 : Type the following command "set-ExecutionPolicy RemoteSigned"

Step3: Press Y for your Confirmation.

like image 42
Rohul Amin Avatar answered Oct 12 '22 23:10

Rohul Amin


Paste this code in your terminal

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Press Enter

Enjoy :)

like image 36
Dayo Jaiye Avatar answered Oct 12 '22 23:10

Dayo Jaiye


Trying to run expo start command via the integrated terminal of visual studio IDE which is by default not authorized.

In such case you open the CMD and run it as an administrator and then type expo start in the project directory. This will work.

For more information please visit this link

like image 39
Badri Paudel Avatar answered Oct 13 '22 00:10

Badri Paudel


Step 1: You need to open your power shell or command line with ‘Run as Administrator’ by right-clicking on its icon.

Step 2: You need to type in the following command:

Set-ExecutionPolicy RemoteSigned

refer

Step 3: You will see the following message and permission request. Type ‘a’ and enter

refer

Solution 2:

Try running the following command in PowerShell after running as administrator.

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy unrestricted

Now go and tried installing and then running ‘Expo’

like image 34
Dilip Singh Panwar Avatar answered Oct 12 '22 23:10

Dilip Singh Panwar


Solution 1:

Trying to run expo start command via the integrated terminal of visual studio IDE which is by default not authorized.

In such a case, you open the CMD and run it as an administrator mode and then type expo --version in the project directory. This will work.

Solution 2:

Try running the following command in PowerShell after running as administrator mode.

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy unrestricted type A Yes to All

Now go and tried installing and then running ‘Expo’

like image 44
Deep Bag Avatar answered Oct 13 '22 00:10

Deep Bag


In case You are using Command Prompt follow this:

  1. Open CMD and Run it as Administrator

2: Run this command: powershell.exe Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy unrestricted

  1. run: expo & you have all set
like image 44
rohit yadav Avatar answered Oct 13 '22 00:10

rohit yadav


. Open Settings, and click/tap on the Update & security icon. 2. Click/tap on For developers on the left side, check the Change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts. box under PowerShell on the right side, and click/tap on the Apply button.

do this thing your problem must be solve if u r windows 10 user

100% Working

like image 23
Dhara Savaliya Avatar answered Oct 13 '22 01:10

Dhara Savaliya


How to set PowerShell script execution policy within Visual Studio Code:

Open Settings, and click/tap on the Update & security icon. 2. Click/tap on For developers on the left side, check the Change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts. box under PowerShell on the right side, and click/tap on the Apply button.

do this thing your problem must be solve if u r windows 10 user

like image 39
Drishty Kumari Avatar answered Oct 12 '22 23:10

Drishty Kumari