Vscode-react-native: Cannot find module 'expo/tools/hashAssetFiles'

Created on 27 Dec 2018  路  4Comments  路  Source: microsoft/vscode-react-native

Actual Behavior

  1. Ran "Debug on Exponent" debug scenario on pure React Native application
  2. Get some Expo error like something went wrong, or receive Metro bundler error.
  3. Get {"error":"Error: Cannot find module 'expo/tools/hashAssetFiles'"} error instead of getting Expo app information that is needed for debugging on localhost:19000 host.

Expected Behavior

Expo app starts debugging

Software versions

  • React-Native VS Code extension version: 0.7.0
  • VSCode version: 1.30.1
  • OS platform and version: Windows 10, macOS Mojave 10.14.2, (Linux is not tested yet, but may be affected)
  • NodeJS version: 8.12
  • React Native version: 0.57.8
  • Expo SDK version (include if relevant): 31.0.0

This behaviour is connected to a bug described in this issue that reproduces on latest [email protected] package.
Until this situation is resolved you can use such solution:

  1. Open vsmobile.vscode-react-native-0.x.x extension folder in your VS Code extensions folder.

    • Windows: %USERPROFILE%\.vscode\extensions

    • macOS: ~/.vscode/extensions

    • Linux: ~/.vscode/extensions

  2. Open node_modules, find and delete xdl folder.
  3. Open vsmobile.vscode-react-native-0.x.x extension folder in terminal and run this command
npm i [email protected] --no-save
  1. Close and reopen VS Code.
expo external known-issues

Most helpful comment

Due to official Expo team commentary all RN projects that are going to be ran using expo must have installed expo package. To solve the issue run npm i expo --save-dev

All 4 comments

Due to official Expo team commentary all RN projects that are going to be ran using expo must have installed expo package. To solve the issue run npm i expo --save-dev

I stumbled upon the same problem and after a while, I realized that the react-native commands were using the wrong package.

Instead of using this:
npm i -g react-native

Make sure you use this:
npm i -g react-native-cli

If it won't install (citing something about react-native already existing) then use the --force flag like this:
npm install -i -g --force react-native-cli

You might also need to run the installation command using sudo in case you have permission issues but I discourage this.

Due to official Expo team commentary all RN projects that is going to be ran using expo must have installed expo package. To solve the issue run npm i expo --save-dev

This solution not work for me

Hi @hadpro24, @HopeKD . Please describe your problems in separate issues.

Was this page helpful?
0 / 5 - 0 ratings