Create react project: npm\expo.ps1 cannot be loaded because running scripts is disabled on this system.

Create react project using react expo framework

ย 

Below is the issue faced while creating a new react project using the command expo init <Project Name> the root cause is due to the execution policy while creating the react project for the current user.

Issue:

c:> expo init ReactTraining

expo : File C:Usersuser1AppDataRoamingnpmexpo.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 init ReactTraining
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

Solution:
c:> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Response

C:Usersuser1Documentsreact> expo init ReactTraining
โˆš Choose a template: ยป blank a minimal app as clean as an empty canvas
โˆš Downloaded template.
๐Ÿ“ฆ Using npm to install packages.
โˆš Installed JavaScript dependencies.

โœ… Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

  • cd ReactTraining
  • npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
  • npm run android
  • npm run ios # requires an iOS device or macOS for access to an iOS simulator
  • npm run web

Ref: React JS Documentation

Enable Notifications OK No thanks