expo : File C:\Users\HP\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 start
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Nayak Tech, Here to help you resolve the error preventing you from running expo start.
The error indicates that PowerShell script execution is disabled on your system, blocking Expo's PowerShell script from running.
Here's how to enable script execution:
-
Open PowerShell as Administrator:
- Right-click the Start button and select "Windows PowerShell (Admin)".
-
Check Current Execution Policy:
- Type
Get-ExecutionPolicyand press Enter. - If it's "Restricted", you'll need to change it.
- Type
-
Set Execution Policy to "RemoteSigned" (Recommended):
- Type
Set-ExecutionPolicy RemoteSignedand press Enter. - Confirm by typing "Y" and pressing Enter.
- This allows scripts from trusted publishers to run while protecting against potentially malicious scripts.
-
Alternative: Set Execution Policy to "Unrestricted" (Less Secure):
- If you're certain of script safety, type
Set-ExecutionPolicy Unrestrictedand press Enter. - Use with caution, as it allows any script to run.
- If you're certain of script safety, type
-
Verify Change:
- Type
Get-ExecutionPolicyagain to confirm the change.
- Type
-
Retry Expo Command:
- Close and reopen PowerShell (not as administrator).
- Run
expo startagain. It should now execute successfully.
Important Notes:
- If you encounter permission issues, try running PowerShell in the project directory.
- For a more secure approach, consider creating a custom execution policy specifically for Expo scripts.
- If you're still facing issues, provide more details about your environment and any additional error messages.
.png)
.png)
Comments
Post a Comment
Share with your friends :)
Thank you for your valuable comment