Mikita Shykin
Mikita Shykin

Reputation: 11

npm ERR! ERESOLVE unable to resolve dependency tree when installing @nest/microservices

I'm trying to install new dependency to my service,

@nest/microservices: ^7.0.3 and got this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   @nestjs/common@"^8.4.7" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^7.0.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/microservices
npm ERR!   @nestjs/microservices@"^7.0.3" from the root project
npm ERR! 

so versions of packages with problem are:

"@nestjs/common": "^8.4.7",
"@nestjs/core": "^7.6.15"

I tried to upgrade versions of core and microservices dependencies to ^8.0.0, and got more dependencies broken and also tried to downgrade common to ^7.6.15 and got same effect. Tried to use yarn instead of npm, it resolved my problem, but i need all packages to be installed by npm

Upvotes: 1

Views: 2807

Answers (4)

AREMU
AREMU

Reputation: 51

FIXED:npm ERR! ERESOLVE unable to resolve dependency tree when installing @nest/microservices

$ npm install -g @nestjs/cli npm-check-updates
   $ nest update --force
    Open NestJs project
     $ npm-check-updates "/@nestjs*/" -u
     $ npm-check-updates "/nestjs*/" -u    
     $ npm install

Upvotes: 0

I think the problem was that you used the wrong command:

npm i @nest/microservices

The correct could be this:

npm i @nestjs/microservices

Upvotes: 0

Dilan Ariza
Dilan Ariza

Reputation: 1

you can see the solution here, or at least this is what worked for me here. https://www.angularjswiki.com/angular/unable-to-resolve-dependency-tree-error-in-angular-while-installing-npm-packages/

I leave you the part where it worked for me

To fix Unable to resolve dependency tree error in Angular while installing npm packages follow the below steps.

  1. Run npm install --save --legacy-peer-deps instead of npm install command. Another way is delete the node_modules folder and package_lock.json file and then
  2. Run npm cache clean --force after npm i --force command.

Upvotes: 0

Mikita Shykin
Mikita Shykin

Reputation: 11

So, I resolved this problem, with deleting node_modules, package-lock.json and removing dependencies and devDependencies in package.json

After i've installed all dependencies manually one by one

Upvotes: 0

Related Questions