当我npm start
在powershell中运行时,显示以下错误错误:
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
我怎样才能解决这个问题?
我只是有这个问题。我这样解决了:
我在NVM上使用了旧的Node版本。我更改为上一个节点版本
nvm use 12.x.x
与nvm
和更新:
yarn global add expo-cli
但是,您需要运行
npm install expo-cli --global
为npm
。之后,我改回旧版本:
nvm use 10.x.x
跑了
yarn start
要么
npm start
这解决了问题。