Rainbow Coding

Introducing NPM unable to resolve dependency tree

Node.js 15+ and npm 7 might cause some packages to break. How to get around it?

npm v7 has changed some internals of it so you might run into some problems with installing packages.

Here's an example what might happen:

$ npm install --save-dev @nuxtjs/storybook
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peerOptional react@"^16.8.0 || ^17.0.0" from @storybook/addon-essentials@6.1.21

and the error message goes on.

The fix is easy:

npm install --save-dev @nuxtjs/storybook--legacy-peer-deps

This might not be required anymore as some packages update to more proper ways of handling dependencies.

Read more details about this change on npm blog.

© RainbowCoding 2010-2023