Vscode-react-native: [Bug] Unable to run Expo app from VSCode Run

Created on 15 Mar 2021  路  7Comments  路  Source: microsoft/vscode-react-native

馃悰 What is the bug? How can we reproduce it?

  1. Update to newest Expo version, VSCode version, etc..
  2. Create a managed workflow expo app with expo init my-app
  3. Run the app with expo start from terminal -> work fine
  4. Open project in VSCode, create launch.json
  5. Run with the option Debug in Exponent -> scan and open in iOS/Android -> always show This project requires a newer version of Expo Go - please download the latest version from App Store and permanently locked in this mode even after delete launch.json and/or run from terminal.
  6. Error showing incompatible SDK version.

Edit: Issue might be lie in app.json - sdkVersion being generated wrong version, expo version is only 40.0.1 not 41.0.0 I think.

Expected behavior

Can run without the message.

Debug output


Debug Console


Launching the application
Attaching to the application
Starting debugger app worker.
Established a connection with the Proxy (Packager) to the React Native application


React Native output channel

[Info] Making sure your project uses the correct dependencies for Expo. This may take a while...

Checking if this is Expo app......
[Info] Starting Packager

[Info] Packager started.

[Info] Prewarming bundle cache. This may take a while ...

[Info] Building and running application.

No issue with doctor-config-json-not-readNo issue with doctor-watchman-versionNo issue with doctor-problem-checking-watchman-versionNo issue with doctor-unversionedNo issue with doctor-versions-endpoint-failedNo issue with doctor-invalid-sdk-versionNo issue with doctor-schema-validationNo issue with doctor-validate-asset-fieldsNo issue with doctor-schema-validation-exceptionNo issue with doctor-react-native-not-installedTunnel ready.[Info] Enable JS Debugging

[Info] Packager is already running.

No issue with doctor-config-json-not-readNo issue with doctor-watchman-versionNo issue with doctor-problem-checking-watchman-versionNo issue with doctor-unversionedNo issue with doctor-versions-endpoint-failedNo issue with doctor-invalid-sdk-versionNo issue with doctor-schema-validationNo issue with doctor-validate-asset-fieldsNo issue with doctor-schema-validation-exceptionNo issue with doctor-react-native-not-installedNo issue with doctor-config-json-not-readNo issue with doctor-watchman-versionNo issue with doctor-problem-checking-watchman-versionNo issue with doctor-unversionedNo issue with doctor-versions-endpoint-failedNo issue with doctor-invalid-sdk-versionNo issue with doctor-schema-validationNo issue with doctor-validate-asset-fieldsNo issue with doctor-schema-validation-exceptionNo issue with doctor-react-native-not-installed

Environment

Please tell us about your system and your project:

  • npx react-native doctor or npx expo doctor if your project is using Expo:
Didn't find any issues with the project!
  • envinfo:

  System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
    Memory: 128.61 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.2.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
    Homebrew: 2.7.5 - /usr/local/bin/brew
    pip3: 20.3.3 - /usr/local/bin/pip3
    RubyGems: 3.0.3 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.24.3 - /usr/bin/git
    Clang: 1200.0.32.29 - /usr/bin/clang
  Servers:
    Apache: 2.4.41 - /usr/sbin/apachectl
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Nano: 2.0.6 - /usr/bin/nano
    Sublime Text: Build 3211
    VSCode: 1.54.2 - /usr/local/bin/code
    Vim: 8.1 - /usr/bin/vim
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 12.0.2 - /usr/bin/javac
    Perl: 5.18.4 - /usr/bin/perl
    PHP: 7.3.11 - /usr/bin/php
    Protoc: 3.14.0 - /usr/local/bin/protoc
    Python: 2.7.16 - /usr/bin/python
    Python3: 3.9.1 - /usr/local/bin/python3
    Ruby: 2.6.3 - /usr/bin/ruby
  Databases:
    SQLite: 3.28.0 - /usr/bin/sqlite3
  Browsers:
    Brave Browser: 89.1.21.76
    Safari: 14.0.2
  • React Native Tools extension version: 1.4.1
  • Expo SDK version (if applicable): 4.0.0.1
bug

All 7 comments

Hi @Tj3n and thanks for reaching us.
Under the hood the extension uses expo/xdl package to run Expo apps. While investigating we found out the problem could occur due to incorrect mapping of React Native and Expo SDK versions in this function. The extension uses that function to prepare the project for debugging in VS Code. During the preparation, the extension is modifying app.json file and adding sdkVersion property with the mapped Expo SDK version there.
Could you please open app.json file in your project root folder and check if sdkVersion property is set to 40.0.0? If the property contains 41.0.0 sdk version, please replace it with 40.0.0 and then try to debug the application again.
Please let us know about your results.

Hi @RedMickey,
I tried that and it seems to solve the problem. Took quite long time to figure out the reason though 馃槄, would you guys able to fix it or it's the expo-cli bug?

@Tj3n, we'll open an issue about this problem in expo-cli repo.
It seems that Expo accidentally updated the map file with versions in their versions/latest endpoint and added Expo SDK 41 version, before its release.

@Tj3n, I opened the issue https://github.com/expo/expo-cli/issues/3288 in expo-cli repo. We'll track its progress.

Thanks!

Hi @Tj3n , It looks like expo has migrated from the @expo/xdl package to the xdl package. Therefore, we migrated to the xdl package too. These changes will be released in the next version of React Native Tools.

You can install the extension with this fix by following these steps:

  1. Download and unzip compiled extension VSIX
  2. Uninstall the extension
  3. Reopen VS Code
  4. Click Extensions -> Views and More Actions ... -> Install from VSIX ... And select the downloaded VSIX

Could you please check if this fix works for you?

Hi @JiglioNero ,
It works well for me. Thanks!

Was this page helpful?
0 / 5 - 0 ratings