【问题标题】:Cannot determine which native SDK version your project uses because the module `expo` is not installed无法确定您的项目使用哪个原生 SDK 版本,因为未安装模块 `expo`
【发布时间】:2020-05-15 07:14:43
【问题描述】:

当我在 powershell 中运行npm start 时显示以下错误错误:

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

我该如何解决这个问题?

【问题讨论】:

  • 你安装了 expo-cli 吗?你甚至在使用世博会吗?还是只是反应原生?

标签: node.js react-native npm


【解决方案1】:

我刚遇到这个问题。我是这样解决的:

我使用的是带有 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

这解决了问题。

【讨论】:

    【解决方案2】:

    我遇到了这个问题。我安装了yarn,然后运行命令“yarn add expo”。

    【讨论】:

      猜你喜欢
      • 2021-07-01
      • 1970-01-01
      • 2022-01-06
      • 1970-01-01
      • 1970-01-01
      • 2017-07-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-10
      相关资源
      最近更新 更多