-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] pino
and rxjs
should be peer dependencies of nestjs-pino
#1004
Comments
Sorry, I'm not a user of pnpm. But rxjs is a dependency of nestjs, and pino-http is a peer dependency, that should be installed by end user, and it includes pino. This peer dependency allows control of it's versions by end user. Do you install both nestjs-pino and pino-http as mentioned in the docs? |
I can't claim to say I understand pnpm's resolution patterns fully, but if I had to guess, the nested node_modules structure which pnpm uses places packages in the places a consumer expects them to be based on the package.json of that lib. In practice, there are issues resolving any pkg which is imported and used directly by a project's codebase if it is not defined either as a peer dependency or a dependency by that project. The places I had issues:
This is to say, these same modules have no issue with importing @nestjs/common 🤷 I updated my solution above, pino-http was not an issue, only pino and rxjs. Additionally, they were only required to be added in peerDependencies. |
So, the solution is to add both |
pino
and rxjs
should be peer dependencies of nestjs-pino
Since this library is to log nestjs log errors through pino, it seems reasonable that pino be exposed as a peerDependency instead of a devDependency like currently. The workaround works great but really adds to the friction of your library. My two cents. |
- pino-http 6.4.0 requires pino ^7.5.0: https://github.com/pinojs/pino-http/blob/v6.4.0/package.json - pino-http 8 & 9 require pino ^8: https://github.com/pinojs/pino-http/blob/v8.6.1/package.json & https://github.com/pinojs/pino-http/blob/v9.0.0/package.json - pino-http 10 require pino ^9: https://github.com/pinojs/pino-http/blob/v10.3.0/package.json
nestjs/common 8 to 10 require rxjs ^7.1.0
- pino-http 6.4.0 requires pino ^7.5.0: https://github.com/pinojs/pino-http/blob/v6.4.0/package.json - pino-http 8 & 9 require pino ^8: https://github.com/pinojs/pino-http/blob/v8.6.1/package.json & https://github.com/pinojs/pino-http/blob/v9.0.0/package.json - pino-http 10 require pino ^9: https://github.com/pinojs/pino-http/blob/v10.3.0/package.json
nestjs/common 8 to 10 require rxjs ^7.1.0
Hi! I had the same issue when building an application for prod, with npm, within a docker container. So I've opened this PR: #2103 |
Similar issue with yarn pnp, work around is to use yarn packageExtensions: packageExtensions:
"nestjs-pino@*":
peerDependencies:
"pino": "*"
"rxjs": "*"
"pino-pretty": "*"
"pino-http@*":
peerDependencies:
"pino-pretty": "*" |
[X] I've read the docs of nestjs-pino
[X] I've read the docs of pino
[X] I couldn't find the same open issue of nestjs-pino
What is the current behavior?
When using
pnpm
, installing using the--prod
flag omits dependencies used within the code, namely, the following:As these are only defined in devDependencies, they are not installed correctly by pnpm.
at the moment, this can be solved with a pnpm
readPackage
hook to add the correct dependencies in:What is the expected behavior?
pino, pino-http, and rxjs are included in
"dependencies"
, so they are included in production installs of the package.Please provide minimal example repo. Without it this issue will be closed
I will attempt to get this for you soon.
Please mention other relevant information such as Node.js version and Operating System.
The text was updated successfully, but these errors were encountered: