Warm tip: This article is reproduced from stackoverflow.com, please click
node.js npm react-native

Cannot determine which native SDK version your project uses because the module `expo` is not installed

发布于 2021-01-21 18:06:56

When I run npm start in powershell is shows the following error error:

PS C:\Users\UTKARSH\Desktop\react_native\my_project> npm start

@ start C:\Users\UTKARSH\Desktop\react_native\my_project
expo start

Starting project at C:\Users\UTKARSH\Desktop\react_native\my_project
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
    at Object.getExpoSDKVersion (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Project.ts:22:9)
    at ensureConfigHasDefaultValues (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:419:22)
    at fillAndReturnConfig (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:101:10)
    at getConfig (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:137:10)
    at configureProjectAsync (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:288:25)
    at action (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:164:34)
    at C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
    at Command.<anonymous> (C:\Users\UTKARSH\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:82:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\UTKARSH\AppData\Roaming\npm-cache\_logs\2020-05-15T07_09_48_901Z-debug.log
PS C:\Users\UTKARSH\Desktop\react_native\my_project> clear

How can I fix this?

Questioner
utkarsh sharma
Viewed
0
2,521 2020-09-24 19:56

I just had this problem. I solved it like this:

I was using old Node version with NVM. I changed to the last node version

nvm use 12.x.x

with nvm and updated:

yarn global add expo-cli

but, you need run

npm install expo-cli --global

for npm. After that, I changed back to the old version:

nvm use 10.x.x

and ran

yarn start

or

npm start

This solved the issue.