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

Unable to run barebones NestJS app with yarn pnp #15406

Closed
fabiog27 opened this issue Mar 2, 2023 · 2 comments
Closed

Unable to run barebones NestJS app with yarn pnp #15406

fabiog27 opened this issue Mar 2, 2023 · 2 comments

Comments

@fabiog27
Copy link

fabiog27 commented Mar 2, 2023

Current Behavior

If you try to run a NestJS app with nx in combination with yarn v3 in pnp mode, you get a bunch of errors during build about incorrect dependency resolution. This does not happen when running a NestJS app with yarn v3 without nx.

Expected Behavior

I expect the NestJS app to build successfully with this combination of tools. Yarn v3 with pnp as the nodeLinker is giving us great benefits during local & CI builds.

GitHub Repo

https://github.com/fabiog27/nx-nestjs-yarn-example

Steps to Reproduce

  1. Clone the repo
  2. yarn install
  3. yarn nx serve experiment

Nx Report

Node : 18.14.2
   OS   : darwin x64
   yarn : 3.4.1

   nx                      : 15.8.2
   @nrwl/js                : 15.8.2
   @nrwl/jest              : 15.8.2
   @nrwl/linter            : 15.8.2
   @nrwl/workspace         : 15.8.2
   @nrwl/eslint-plugin-nx  : 15.8.2
   @nrwl/nest              : 15.8.2
   @nrwl/node              : 15.8.2
   @nrwl/webpack           : 15.8.2
   typescript              : 4.9.5

Failure Logs

hunk (runtime: main) main.js (main) 1.9 MiB (javascript) 793 bytes (runtime) [entry] [rendered]

WARNING in ../../.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/utils/load-package.util.js 9:39-59
Critical dependency: the request of a dependency is an expression

WARNING in ../../.yarn/cache/express-npm-4.18.2-bb15ff679a-3c4b9b0768.zip/node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/concat.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/concat.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/concat.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/filter.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/filter.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/filter.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/flatten.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/flatten.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/flatten.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/index.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/index.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/index.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/iterate.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/iterate.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/iterate.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/map.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/map.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/map.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/slice.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/slice.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/slice.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/utils.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/utils.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/utils.ts'

WARNING in ../../.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/lib/zip.js
Module Warning (from ../../.yarn/__virtual__/source-map-loader-virtual-ffe0e71b95/0/cache/source-map-loader-npm-3.0.2-6e868d7f08-d5a4e2ab19.zip/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/cache/iterare-npm-1.2.1-b666309be8-70bc80038e.zip/node_modules/iterare/src/zip.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/iterare/src/zip.ts'

WARNING in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/helpers/load-adapter.js 9:39-63
Critical dependency: the request of a dependency is an expression

WARNING in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/helpers/optional-require.js 6:39-59
Critical dependency: the request of a dependency is an expression

ERROR in ../../.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/cache/cache.providers.js 17:108-132
Module not found: Error: @nestjs/common tried to access cache-manager (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: cache-manager
Required by: @nestjs/common@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/cache/)

Ancestor breaking the chain: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/testing@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/pipes/validation.pipe.js 38:174-200
Module not found: Error: @nestjs/common tried to access class-validator (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: class-validator
Required by: @nestjs/common@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/pipes/)

Ancestor breaking the chain: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/testing@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/pipes/validation.pipe.js 41:182-210
Module not found: Error: @nestjs/common tried to access class-transformer (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: class-transformer
Required by: @nestjs/common@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/pipes/)

Ancestor breaking the chain: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/testing@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/serializer/class-serializer.interceptor.js 25:244-272
Module not found: Error: @nestjs/common tried to access class-transformer (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: class-transformer
Required by: @nestjs/common@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/__virtual__/@nestjs-common-virtual-5682bc52e1/0/cache/@nestjs-common-npm-9.3.9-aa8dde60a2-48fde36bef.zip/node_modules/@nestjs/common/serializer/)

Ancestor breaking the chain: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/testing@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/nest-application.js 19:107-150
Module not found: Error: @nestjs/core tried to access @nestjs/websockets (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @nestjs/websockets
Required by: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/)

Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: @nestjs/testing@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/nest-application.js 20:124-177
Module not found: Error: @nestjs/core tried to access @nestjs/microservices (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @nestjs/microservices
Required by: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/)

Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/nest-application.js 122:120-152
Module not found: Error: @nestjs/core tried to access @nestjs/microservices (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @nestjs/microservices
Required by: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/)

Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



ERROR in ../../.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/nest-factory.js 57:120-152
Module not found: Error: @nestjs/core tried to access @nestjs/microservices (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @nestjs/microservices
Required by: @nestjs/core@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9 (via /Users/fabio/projects/test/nx-nestjs-yarn-example/.yarn/unplugged/@nestjs-core-virtual-e8ebea8e3e/node_modules/@nestjs/core/)

Ancestor breaking the chain: @nestjs/platform-express@virtual:97b59d416a009439fa8dbc23c5107e61f2df4eeb4d52731c32ca239deaeb6407a49d416ea32b9198a31d27f9142fe2b91a03d92e3f0ad8d911021b64e723395a#npm:9.3.9
Ancestor breaking the chain: experiment@workspace:.



webpack compiled with 8 errors and 13 warnings (2bb0c791ddacc81d)
There was an error with the build. See above.

Additional Information

No response

@AgentEnder
Copy link
Member

NX doesn't currently support yarn PnP, the request is tracked by #2386. I'm going to close this as a duplicate, since it is tracked elsewhere.

We would like to move forward with PnP support at some point, but its not a small effort and we are currently prioritizing other tasks.

@github-actions
Copy link

github-actions bot commented Apr 2, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants