Error in executing expo commands in powershell

Asked

Viewed 1,106 times

2

I’m taking a chance on React Native and it turns out that when I try to execute the command expo init, or even expo --version through Powershell is giving the following error:

expo : 
  O arquivo C:\Users\Lucas\AppData\Roaming\npm\expo.ps1 não pode ser carregado. 
  O arquivo
C:\Users\Lucas\AppData\Roaming\npm\expo.ps1 não está assinado digitalmente.
  Não é possível executar este script no sistema atual. 
  Para obter mais informações sobre como executar scripts e definir a 
   política de execução, consulte about_Execution_Policies at
   https://go.microsoft.com/fwlink/?LinkID=135170.

No linha:1 caractere:1
+ expo --version
+ ~~~~
    + CategoryInfo          : ErrodeSegurança: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Turns out the old cmd command runs, and through some queries here and there I figured out how to change the script protection policies, so I switched to bypass and it runs, but I believe I leave my computer vulnerable like this, then I ask: how do I add the expo as an exception so that it can be executed, because even with Allsigned it does not respond to commands!

*Excuse me, my first time in the community and starting in this wonderful art of being a programmer!

1 answer

0

Hello I had the same problem and the solution found with ease was to change the execution policy but as you said correctly leaves the computer vulnerable. The solution I found was to use the npm start instead of expo start, of course as long as the expo is installed and the powershell log works perfectly:

PS C: Users super multiInstagram> npm start

@ start C: Users super multiInstagram expo start

Starting project at C: Users super multiInstagram Expo Devtools is running at http://localhost:19002 Opening Devtools in the browser... (press shift-d to disable) Starting Metro Bundler

Exp://192.168.0.100:19000

You can see the Expo documentation in the link below, in the item Starting the Development server:

When you run expo start (or npm start), Expo CLI Starts Metro Bundler, which is an HTTP server that compiles the Javascript code of our app using Babel and serves it to the Expo app. It also Pops up Expo Dev Tools, a Graphical interface for Expo CLI.

source: https://docs.expo.io/get-started/create--new-app/#Starting-the-Development-server

Browser other questions tagged

You are not signed in. Login or sign up in order to post.