nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.28k stars 7.59k forks source link

Peer Deps #6028

Closed tommyc38 closed 3 years ago

tommyc38 commented 3 years ago

Bug Report

Current behavior

A fresh nestjs install requires microservices

Input Code

npm WARN @nestjs/core@7.6.4 requires a peer of @nestjs/microservices@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/testing@7.6.4 requires a peer of @nestjs/microservices@^7.0.0 but none is installed. You must install peer dependencies yourself.

Once @nestjs/microservices@7.6.4 is installed I get the following

npm WARN @nestjs/microservices@7.6.4 requires a peer of amqp-connection-manager@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of amqplib@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of grpc@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of kafkajs@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of mqtt@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of nats@* but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/microservices@7.6.4 requires a peer of redis@* but none is installed. You must install peer dependencies yourself.

Expected behavior

Nowhere in your docs does it mention we need to have @nestjs/microservices installed in order to run a nestjs app. Moverover, we shouldn't have to install all of the other dependencies if we aren't using microservices

Possible Solution

Environment

"dependencies": {
    "@angular/animations": "^11.0.0",
    "@angular/cdk": "^11.0.3",
    "@angular/common": "^11.0.0",
    "@angular/compiler": "^11.0.0",
    "@angular/core": "^11.0.0",
    "@angular/flex-layout": "^11.0.0-beta.33",
    "@angular/forms": "^11.0.0",
    "@angular/material": "^11.0.3",
    "@angular/platform-browser": "^11.0.0",
    "@angular/platform-browser-dynamic": "^11.0.0",
    "@angular/router": "^11.0.0",
    "@nestjs/common": "^7.6.4",
    "@nestjs/core": "^7.6.4",
    "@nestjs/platform-express": "^7.0.0",
    "@nrwl/angular": "11.0.18",
    "reflect-metadata": "^0.1.13",
    "rxjs": "~6.5.5",
    "tslib": "^2.0.0",
    "zone.js": "^0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.1",
    "@angular/cli": "~11.0.0",
    "@angular/compiler-cli": "^11.0.0",
    "@angular/language-service": "^11.0.0",
    "@nestjs/schematics": "^7.0.0",
    "@nestjs/testing": "^7.0.0",
    "@nrwl/cli": "11.0.18",
    "@nrwl/cypress": "11.0.18",
    "@nrwl/jest": "11.0.18",
    "@nrwl/nest": "^11.0.18",
    "@nrwl/node": "11.0.18",
    "@nrwl/nx-cloud": "latest",
    "@nrwl/storybook": "^11.0.18",
    "@nrwl/tao": "11.0.18",
    "@nrwl/workspace": "11.0.18",
    "@storybook/addon-docs": "^6.1.11",
    "@storybook/addon-knobs": "^6.1.11",
    "@storybook/angular": "^6.1.11",
    "@types/jest": "26.0.8",
    "@types/node": "12.12.38",
    "@types/webpack": "4.41.21",
    "codelyzer": "^6.0.0",
    "css-loader": "^5.0.1",
    "cypress": "^5.5.0",
    "dotenv": "6.2.0",
    "eslint": "7.10.0",
    "fibers": "^4.0.3",
    "jest": "26.2.2",
    "jest-preset-angular": "8.3.1",
    "node-sass": "^4.14.1",
    "prettier": "2.1.2",
    "sass-loader": "^10.1.0",
    "style-loader": "^2.0.0",
    "sveltedoc-parser": "^3.0.5",
    "ts-jest": "26.4.0",
    "ts-node": "~9.1.1",
    "tsconfig-paths-webpack-plugin": "^3.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.3"
  }

For Tooling issues:

Others:

jmcdo29 commented 3 years ago

These were added as peer dependencies to make the framework yarn berry (yarn v2) compliant. They are optional peer dependencies and do not need to be installed unless you are making use of them.

tommyc38 commented 3 years ago

Thanks for the response. I am glad that yarn works without issues. How can I mute this warning with npm?

jmcdo29 commented 3 years ago

Short answer: set the npm logLevel to error. Long answer: there's a really long history of comments in npm's repo about what should and what shouldn't be made supressable and there's no real clear answer to it. This conversation goes back to 2014 and was locked/archived in 2018.

tommyc38 commented 3 years ago

@jmcdo29 Thank you!

tommyc38 commented 3 years ago

@jmcdo29 FYI, I upgraded my npm package (npm i -g npm@latest) and that fixed all of the errors as well. Cheers mate!