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