【问题标题】:Cannot determine which native SDK version your project uses because the module `expo` is not installed. Ubuntu 20.04无法确定您的项目使用哪个原生 SDK 版本,因为未安装模块 `expo`。 Ubuntu 20.04
【发布时间】:2021-07-01 20:48:56
【问题描述】:

我最初使用 Yarn 安装了 expo-cli,但它不起作用,所以我只是使用 npm 进行了全局安装。使用expo init "site name" --name "name" -t blank --yarn 创建新项目后,expo start 不再起作用。完成此操作后,我下载了 Android Studio 并启动了一个虚拟设备。

这是我输入expo start后的错误信息:

┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│   There is a new version of expo-cli available (4.3.4).                 │
│   You are currently using expo-cli 3.28.6                               │
│   Install expo-cli globally using the package manager of your choice;   │
│   for example: `npm install -g expo-cli` to get the latest version      │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘
Starting project at /home/user/"location"
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 (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/node_modules/@expo/config/src/Project.ts:23:9)
    at ensureConfigHasDefaultValues (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/node_modules/@expo/config/src/Config.ts:433:18)
    at fillAndReturnConfig (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/node_modules/@expo/config/src/Config.ts:112:10)
    at getConfig (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/node_modules/@expo/config/src/Config.ts:149:10)
    at configureProjectAsync (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/src/commands/start.ts:287:25)
    at action (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/src/commands/start.ts:160:34)
    at /home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/src/commands/start.ts:334:16
    at Command.<anonymous> (/home/user/.nvm/versions/node/v14.9.0/lib/node_modules/expo-cli/src/exp.ts:332:7)

expo 诊断给了我这个:


  Expo CLI 3.28.6 environment info:
    System:
      OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
      Shell: 5.0.17 - /bin/bash
    Binaries:
      Node: 14.9.0 - ~/.nvm/versions/node/v14.9.0/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v14.9.0/bin/yarn
      npm: 6.14.8 - ~/.nvm/versions/node/v14.9.0/bin/npm
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.7199119
    npmPackages:
      react: ^17.0.1 => 17.0.1 
      react-dom: ^17.0.1 => 17.0.1 
    npmGlobalPackages:
      expo-cli: 3.28.6
    Expo Workflow: managed

【问题讨论】:

    标签: ubuntu npm sdk expo yarnpkg


    【解决方案1】:

    npm更新到最新版本->npm install -g npm@latest

    卸载expo -> npm uninstall -g expo-cli --save

    删除.expo文件夹,重装expo就可以了

    【讨论】:

    • 谢谢,但这并没有解决我的问题
    【解决方案2】:

    我完全进入了错误的目录。简单的错误,简单的修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-02
      • 2023-03-02
      • 2021-01-01
      • 2020-11-30
      • 2017-06-26
      • 1970-01-01
      • 2021-09-27
      • 2020-10-03
      相关资源
      最近更新 更多