Abdulrahman Hashem
Abdulrahman Hashem

Reputation: 1869

How to tell Expo to install npm dependencies with --legacy-peerdeps option?

I'm trying to build my Expo mobile app locally.

When Expo starts the [INSTALL_DEPENDENCIES] step, it performs npm install. But in my case, I'm aware of a legacy package I'm using which is causing some problems. So, this step is broken and the build is failing.

I want to configure Expo to perform npm install --legacy-peer-deps instead of npm install.

In my case, I have [email protected] with Expo SDK 46.

Is this option configurable?

Upvotes: 10

Views: 5340

Answers (1)

Abdulrahman Hashem
Abdulrahman Hashem

Reputation: 1869

After looking a little bit, I figured it out using:

Create .npmrc file in the project root directory with:

legacy-peer-deps=true

However, another option is to run npm config set legacy-peer-deps true in eas-build-pre-install hook.

In package.json, add the following to scripts:

 "eas-build-pre-install": "npm config set legacy-peer-deps true"

Upvotes: 32

Related Questions