Posted on Leave a comment

npm ERR! ERESOLVE could not resolve dependency

I was working on a project which had a node install task as a part of a docker file build. The build was not successful due to the error shown below. This is a dependency error and can be solved by choosing the right versions on your package-lock.json.

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

However there is also another way you can get rid of such cases. If you do have specific dependencies inside your package-lock.json you can proceed with the following steps.

Remove package-lock.json from your project
Remove node_modules folder 
Run npm install