Search code examples
react-nativenpmexpoyarnpkg

Error with React Native when trying to start App


I'm following the steps provided in the Documentation to set up the environment for React Native. I have installed create-react-native-app as well as expo-cli . Further I have created an app using expo init.

Now when I'm trying to run the app with yarn start or npm start I get the following error:

Error: spawn powershell ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.

How do i solve it? is that something related to powershell? (But i get it in Command Prompt too)

P.S. I'm using Windows 8, Expo 3.24.2, yarn 1.22.4, node 10.15.3


Solution

  • I also faced the same error while running yarn start. To fix this: go to

    1. Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables.
    2. Under User variables -> Variable PATH -> add a new path i.e, (C:\Windows\System32\WindowsPowerShell\v1.0)
    3. Then click Ok and close the Control Panel.
    4. Now open Windows Powersell and write: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
    5. Click enter and close the powershell
    6. reopen the cmd and type yarn start or npm start

    Error is gone :)