Getting an error while "npm install" after deletion of package.lock.json file in the module. [OS - Windows]

1.7k Views Asked by At

I want to delete package-lock.json file in a module and to use npm install. But while npm install running, I got an error saying "unable to resolve dependency tree".

Whole error: ["unable to resolve dependency tree" while resolving: [email protected] Found: [email protected] node_modules/react-redux react-redux@"7.1.0" from the root project. could not resolve dependency: peer react-redux@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from [email protected] node_module/reduxform-validators redux-formvalidators @"^2.7.5" from the root project fix the upstream dependency conflict, or retry this command with--force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

enter image description here

I followed more tutorials and documentations. But I could not solve down it.

2

There are 2 best solutions below

0
On

There are packages which use some other packages. After npm version 7(my guess), they have added this warning. This is just to inform us about those packages.

To resolve it as it is mentioned use --force

Whole command:

npm install --force

This should solve your issue and the project should work as expected.

0
On

You have a package that depended on an older version of redux and you have a newer version. You should use the command:

npm install --legacy-peer-deps

The --legacy-peer-deps is a way to bypass peerDependency auto-installation, it tells NPM to ignore peer dependencies and proceed with the installation anyway.

Note that this may result in conflicts due to potentially breaking changes