Unable to resolve module `react-native-gesture-handler` from...

Hello.

I upgraded Expo SDK to the newest 34.0.0 (from 32).

It turns out that now I have to manuall install some packages, e.g. 'react-native-gesture-handler` or ‘barcode-scanner’.

On the other hand, It seems I don’t have to do it with ‘alert’ or ‘constants’. But what is the pattern here, how to remember what needs to be installed and what not, and also - why - why were they preinstalled on 32 and now we have to manually add them?

Hi!

Answers to most of your questions can be found in our release notes for SDK 34:

In SDK 33, we deprecated imports from the monolith expo package in favor of installing and importing from individual module packages like expo-file-system . With SDK 34, we’ve fully removed the ability to import most modules from the expo package. This means that if you try to import { FileSystem } from 'expo'; , you’ll now see an error instead of a warning.

To remedy this, you should use the expo install command to install modules; this command is a wrapper around npm install / yarn add that automatically installs a module version compatible with your SDK version. For example, for the FileSystem module, you should run expo install expo-file-system and use import * as FileSystem from 'expo-file-system'; .

This change paves the way for tree-shaking and smaller JavaScript bundles. It also makes moving between Expo’s managed and bare workflows simpler. To make the transition smoother, we’re providing expo-codemod , a command line utility that will parse your JS and automatically update any affected imports. Instructions are on the linked README page.

If you still see an error screen after fixing all of the imports in your application code, one or more of your dependencies may still use the old import style. In that case, you’ll need to upgrade those dependencies to versions that support the new import style. If none are available, unfortunately you’ll need to wait to upgrade. (If this is a package we manage, please let us know, or send a PR!)

The warnings (or errors if you’re on SDK 34) will say exactly how to import the package, and the docs for each API also state the correct import syntax

1 Like

Thank you! For me it’s all new things, wasn’t sure where to look for information, the blog is now added to my sources :slight_smile: Thanks again!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.