"react - native link error File C:\Users\pc\AppData\Roaming\npm\react-native.ps1 cannot be loaded"

Viewed 5303

Error message:

react-native : File C:\Users\pc\AppData\Roaming\npm\react-native.ps1 cannot be loaded. The
file C:\Users\pc\AppData\Roaming\npm\react-native.ps1 is not digitally signed. You cannot run
this script on the current system. For more information about running scripts and setting
execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ react-native link
+ ~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

How can I solve this? I have installed npm, Node.js and JDK. I have done the tutorial for Okta authentication and in the step of react-native link I get this error.

2 Answers

Try setting your execution policy in PowerShell to remote signed.

Open a new PowerShell administrator window and run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser.

There’s also a way to allow running PowerShell scripts on Windows in Settings somewhere, but I don’t remember where. Probably in Developer Settings.

Nothing to worry about this just run PowerShell as admin and run command below in that

steps

  1. Go to Start Menu
  2. Type PowerShell
  3. Right Click PowerShell and run as administrator
  4. And Run set-executionpolicy remotesigne in PowerShell
Related