question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: After `@ogma/logger@2.4.1`, peer deps of `@ogma/platform-fastify@4.0.0` can’t be resolved

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I get some peer dependency issues which I can’t resolve by myself.

When running npm i @ogma/logger@latest @ogma/nestjs-module@latest @ogma/platform-fastify@latest @ogma/platform-tcp@latest in a new empty folder with the default package.json (output of npm init -y), it installed @ogma/logger@2.3.0 (the other packages are of latest version), it completes successfully (obviously). However, when I install @ogma/logger@2.3.0, it fails (due to peer deps issues above). When I force it (using --force), it completes successfully (albeit with warnings), however, any subsequent installations of any packages won’t complete unless forced.

Now, in node_modules/@ogma/platform-fastify/package.json, I have the following:

"peerDependencies": {
  "@nestjs/platform-fastify": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "fastify": ">=4.0.0",
  "@ogma/logger": "2.3.0",
  "@ogma/common": "1.1.0",
  "@ogma/styler": "1.0.0"
},

however, in packages/platform-fastify/package.json, there is no @ogma/logger/@ogma/common/@ogma/styler peer dependency:

https://github.com/jmcdo29/ogma/blob/7b4421506881fba9645e3f85451e620a2e2ff0b0/packages/platform-fastify/package.json#L26-L30

Note that this could be an issues in other packages in this repository, however, I use only four packages (listed in the title of this issue and in the list of package versions).

Minimum reproduction code

not needed

Steps to reproduce

  1. Create a folder and enter it.
  2. npm init -y.
  3. [works, but installs @ogma/logger/2.3.0] npm i @ogma/logger@latest @ogma/nestjs-module@latest @ogma/platform-fastify@latest @ogma/platform-tcp@latest
  4. [fails] npm i @ogma/logger@2.4.1 @ogma/nestjs-module@latest @ogma/platform-fastify@latest @ogma/platform-tcp@latest
  5. [works with warnings] npm i --force @ogma/logger@2.4.1 @ogma/nestjs-module@latest @ogma/platform-fastify@latest @ogma/platform-tcp@latest

Expected behavior

No peer dependency issues.

Package(s) version

  • @ogma/logger: 2.4.1;
  • @ogma/nestjs-module: 4.2.0;
  • @ogma/platform-fastify: 4.0.0;
  • @ogma/platform-tcp: 4.0.0.

Node.js version

19.0.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

See the logs below:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @ogma/platform-fastify@4.0.0
npm ERR! Found: @ogma/logger@2.4.1
npm ERR! node_modules/@ogma/logger
npm ERR!   peer @ogma/logger@"^2.0.0" from @ogma/nestjs-module@4.1.1
npm ERR!   node_modules/@ogma/nestjs-module
npm ERR!     peer @ogma/nestjs-module@"^4.0.0" from @ogma/platform-fastify@4.0.0
npm ERR!     node_modules/@ogma/platform-fastify
npm ERR!       @ogma/platform-fastify@"4.0.0" from the root project
npm ERR!     peer @ogma/nestjs-module@"^4.0.0" from @ogma/platform-tcp@4.0.0
npm ERR!     node_modules/@ogma/platform-tcp
npm ERR!       @ogma/platform-tcp@"4.0.0" from the root project
npm ERR!     1 more (the root project)
npm ERR!   @ogma/logger@"2.4.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @ogma/logger@"2.3.0" from @ogma/platform-fastify@4.0.0
npm ERR! node_modules/@ogma/platform-fastify
npm ERR!   @ogma/platform-fastify@"4.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @ogma/logger@2.3.0
npm ERR! node_modules/@ogma/logger
npm ERR!   peer @ogma/logger@"2.3.0" from @ogma/platform-fastify@4.0.0
npm ERR!   node_modules/@ogma/platform-fastify
npm ERR!     @ogma/platform-fastify@"4.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/ts/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ts/.npm/_logs/2022-10-28T13_40_45_340Z-debug-0.log

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jmcdo29commented, Oct 30, 2022

Just to make this easier to double check for me, once the value in the worksapce.json was updated for the projects, these are the new peerDependencies for each package

Peer Deps Per Project
nestjs-module
{
  "@nestjs/common": "^9.0.0",
  "@nestjs/core": "^9.0.0",
  "@ogma/logger": "^2.0.0",
  "reflect-metadata": "^0.1.0",
  "rxjs": "^7.0.0"
}
platform-express
{
  "@nestjs/platform-express": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0"
}
platform-fastify
{
  "@nestjs/platform-fastify": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "fastify": ">=4.0.0"
}
platform-graphql
{
  "@nestjs/graphql": "^10.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "@ogma/platform-express": "^4.0.0"
}
platform-graphql-fastify
{
  "@nestjs/graphql": "^10.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "@ogma/platform-fastify": "^4.0.0"
}
platform-grpc
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "grpc": "^1.24.0"
}
platform-kafka
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "kafkajs": "^1.12.0 || ^2.0.0"
}
platform-mqtt
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "mqtt": "^4.0.0"
}
platform-nats
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "nats": "^1.4.0 || ^2.0.0"
}
platform-rabbitmq
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "amqp-connection-manager": "^3.2.0 || ^4.0.0",
  "amqplib": "^0.5.0 || ^0.8.0 || ^0.10.0"
}
platform-redis
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "redis": "^3.0.0 || ^4.0.0"
}
platform-socket.io
{
  "@nestjs/platform-socket.io": "^9.0.0",
  "@nestjs/websockets": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "socket.io": "^4.0.0"
}
platform-tcp
{
  "@nestjs/microservices": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0"
}
platform-ws
{
  "@nestjs/platform-ws": "^9.0.0",
  "@nestjs/websockets": "^9.0.0",
  "@ogma/nestjs-module": "^4.0.0",
  "ws": "^7.4.2 || ^8.0.0"
}
1reaction
jmcdo29commented, Oct 30, 2022

Okay, looks like I can use updateBuildableProjectDepsInPackageJson: false in the workspace.json to fix this. I’ll want to double check with some tinkering, but I think I should be able to have a fix up for this within a day or so

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] npm ci can't resolve dependencies without --force, or ...
when I do an npm install --legacy-peer-deps , all dependencies are correctly installed and I can start my app. but when my CI...
Read more >
Unable to resolve dependency tree error when installing npm ...
The problem is about peer dependencies. The solution is to downgrade angular common or the solution is to use legacy dependencies logic for ......
Read more >
How to solve peer dependencies error after updating ... - Reddit
I regularly update dependencies using npm i -g npm-check-updates & then doing ncu -u which updates my package.json with latest versions.
Read more >
Unable to resolve dependency tree error in Angular while ...
It's a dependency conflict (incorrect and potentially broken dependency) error, so run the command with --force or --legacy-peer-deps flag.
Read more >
you must install peer dependencies yourself Code Example
npm WARN codelyzer@6.0.1 requires a peer of tslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found