Skip to content
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

nestjs-otel tried to access tslib, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. #512

Open
coler-j opened this issue Nov 26, 2024 · 2 comments

Comments

@coler-j
Copy link

coler-j commented Nov 26, 2024

Getting the following when using node v22 and yarn 4.5.3 with pnp and upgrading to most recent version of nestjs-otel

Error: nestjs-otel tried to access tslib, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: tslib
Required by: nestjs-otel@virtual:<hash>#npm:6.1.1 (via /project-path/.yarn/__virtual__/nestjs-otel-virtual-<hash>/0/cache/nestjs-otel-npm-6.1.1-<hash>zip/node_modules/nestjs-otel/lib/)

Require stack:
- /project-path/.yarn/__virtual__/nestjs-otel-virtual-<hash>/0/cache/nestjs-otel-npm-6.1.1-<hash>.zip/node_modules/nestjs-otel/lib/index.js
- /project-path/dist/instrumentation/instrumentation.module.js
- /project-path/dist/app.module.js
- /project-path/dist/main.js
    at require$$0.Module._resolveFilename (/project-path/.pnp.cjs:<hash>:13)
    at Function.<anonymous> (node:internal/modules/cjs/loader:1075:27)
    at require$$0.Module._load (/project-path/.pnp.cjs:<hash>:31)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.<anonymous> (node:internal/modules/cjs/loader:1340:12)
    at Hook._require.Module.require (/project-path/.yarn/cache/require-in-the-middle-npm-7.2.0-<hash>.zip/node_modules/require-in-the-middle/index.js:167:34)
    at require (node:internal/modules/helpers:141:16)
    at Object.<anonymous> (/project-path/.yarn/__virtual__/nestjs-otel-virtual-<hash>/0/cache/nestjs-otel-npm-6.1.1-<hash>.zip/node_modules/nestjs-otel/lib/index.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)

Node.js v22.11.0

@coler-j
Copy link
Author

coler-j commented Nov 26, 2024

I don't see tslib in the project dependencies, but I do see this reference:

"importHelpers": true /* Import emit helpers from 'tslib'. */,

@coler-j
Copy link
Author

coler-j commented Nov 26, 2024

"tslib is not a dependency of angular itself. But rather a dependency of the TypeScript compiler when you enable TypeScript importHelpers. Any library that is compiled using importHelpers should always have a direct dependency on tslib and not rely on other libraries to install it."

It looks like you should be adding tslib as a direct dependency of your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant