'Trouble getting Expo React Native environment setup
I am having no end of trouble getting my environment setup correctly for Expo. I have been going around in circles with error messages.
My environment is setup with the following:
- Windows: 11
- NVM: 1.1.9
- Nodejs: 16.13.2
- NPM: 8.4.0
- expo-cli: 5.0.3
Working through the primers I run expo init my-app, which seems to run successfully using the blank template. It returns the following:
C:\Projects\expoenvsetup>expo init my-app
√ Choose a template: » blank a minimal app as clean as an empty canvas
√ Downloaded and extracted project files.
📦 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 my-app
- 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
C:\Projects\expoenvsetup>
I then change to the my-app folder and run expo start and get the error:
Cannot find module ‘resolve-from’
Require stack:
C:\Users\scott\AppData\Roaming\nvm\v16.13.2\node_modules@expo\metro-config\build\ExpoMetroConfig.js
C:\Users\scott\AppData\Roaming\nvm\v16.13.2\node_modules\expo-cli\build\exp.js
C:\Users\scott\AppData\Roaming\nvm\v16.13.2\node_modules\expo-cli\bin\expo.js
I get the same error if I run npm run android which simply runs expo start --android anyway. I tried running npm i from the my-app folder which returned the following output:
C:\Projects\expoenvsetup\my-app>npm install
changed 49 packages, and audited 803 packages in 10s
29 packages are looking for funding
run `npm fund` for details
15 vulnerabilities (4 low, 10 moderate, 1 high)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Running npm audit returns the following:
C:\Projects\expoenvsetup\my-app>npm audit
# npm audit report
ansi-regex >2.1.1 <5.0.1
Severity: moderate
Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/@react-native-community/cli/node_modules/ansi-regex
node_modules/ansi-fragments/node_modules/ansi-regex
node_modules/ora/node_modules/ansi-regex
strip-ansi 4.0.0 - 5.2.0
Depends on vulnerable versions of ansi-regex
node_modules/@react-native-community/cli/node_modules/strip-ansi
node_modules/ansi-fragments/node_modules/strip-ansi
node_modules/ora/node_modules/strip-ansi
@react-native-community/cli 2.0.0-alpha.1 - 2.0.0-rc.5 || >=2.0.1
Depends on vulnerable versions of @react-native-community/cli-hermes
Depends on vulnerable versions of @react-native-community/cli-types
Depends on vulnerable versions of ora
Depends on vulnerable versions of react-native
Depends on vulnerable versions of strip-ansi
node_modules/@react-native-community/cli
react-native <=0.0.0-ffdfbbec0 || >=0.60.0-rc.0
Depends on vulnerable versions of @react-native-community/cli
Depends on vulnerable versions of @react-native-community/cli-platform-android
node_modules/react-native
ansi-fragments *
Depends on vulnerable versions of strip-ansi
node_modules/ansi-fragments
logkitty *
Depends on vulnerable versions of ansi-fragments
node_modules/logkitty
@react-native-community/cli-platform-android *
Depends on vulnerable versions of logkitty
node_modules/@react-native-community/cli-platform-android
@react-native-community/cli-hermes *
Depends on vulnerable versions of @react-native-community/cli-platform-android
node_modules/@react-native-community/cli-hermes
ora 2.0.0 - 4.0.2
Depends on vulnerable versions of strip-ansi
node_modules/ora
@react-native-community/cli-types 5.0.0-alpha.0 - 6.0.0
Depends on vulnerable versions of ora
node_modules/@react-native-community/cli-types
node-fetch <=2.6.6
Severity: high
The `size` option isn't honored after following a redirect in node-fetch - https://github.com/advisories/GHSA-w7rc-rwvf-8q5r
node-fetch is vulnerable to Exposure of Sensitive Information to an Unauthorized Actor - https://github.com/advisories/GHSA-r683-j2x4-v87g
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/isomorphic-fetch/node_modules/node-fetch
isomorphic-fetch 2.0.0 - 2.2.1
Depends on vulnerable versions of node-fetch
node_modules/isomorphic-fetch
fbjs 0.7.0 - 1.0.0
Depends on vulnerable versions of isomorphic-fetch
node_modules/fbemitter/node_modules/fbjs
fbemitter 2.0.3 - 3.0.0-alpha.1
Depends on vulnerable versions of fbjs
node_modules/fbemitter
expo >=14.0.0
Depends on vulnerable versions of fbemitter
node_modules/expo
15 vulnerabilities (4 low, 10 moderate, 1 high)
To address all issues (including breaking changes), run:
npm audit fix --force
I have also tried running expo init my-app --npm but am having the same results, i.e. expo start gives me the same "Cannot find module ‘resolve-from’" error message.
Any thoughts would be greatly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
