close

[Solved] ERESOLVE Unable to resolve dependency tree error when installing npm packages

To Solve ERESOLVE Unable to resolve dependency tree error You just need to set legacy-peer-deps will resolve this error. You just need to run the below command in your terminal: npm config set legacy-peer-deps true And now your error will be solved permanently.

Solution 1: Downgrading node version

You have dependency conflict (incorrect and potentially broken dependency) as it says, So try to run the command with --force, or --legacy-peer-deps. If it doesn’t take effect, the temporary solution is using prior versions of the node (Downgrading node version) as it causes to happen such this kind of errors sometimes.

Solution 2: Use –legacy-peer-deps

Use this command

npm install --save --legacy-peer-deps

Solution 3: npm config set legacy-peer-deps true

In addition to using the --legacy-peer-deps command line option, this can also be set more permanently as a config option:

npm config set legacy-peer-deps true

Solution 4: Try npm cache clean –force

Try removing the node modules and package-lock.json file and run the command npm install or Try npm cache clean --force

Solution 5: Set legacy-peer-deps

To Solve ERESOLVE Unable to resolve dependency tree error You just need to set legacy-peer-deps will resolve this error. You just need to run the below command in your terminal.

npm config set legacy-peer-deps true

And now your error will be solved permanently.

Solution 6: Use –force command

While You are installing any npm package just add –force at the end of your installation command. For Example, I am trying to install sass then my command will look like this.

npm install sass --force

And now, you will no longer face this error.

Summary

So either you need to downgrade nodejs Or set legacy-peer-deps will resolve this error. Hope our solution worked for you. Thanks.

Also, Read

17 thoughts on “[Solved] ERESOLVE Unable to resolve dependency tree error when installing npm packages”

Leave a Comment