Search code examples
node.jsnestjsyarnpkgyarnpkg-v2yarn-v2

Migration from npm to Yarn 2 PnP: ts-loader doesn't find webpack


I am working on a NestJS project.

Until now I have used npm. Now I want to migrate to Yarn 2 with Zero-Install an P'n'P.

However, after following the migration instruction, I get this error:

~/IdeaProjects/service on feature/yarn-migration ⇡3 ❯ yarn explain peer-requirements p0b548                                                                                                                                                                                                           at 17:36:06
➤ YN0000: service@workspace:. doesn't provide webpack, breaking the following requirements:

➤ YN0000: ts-loader@npm:8.0.14 [0b662] → * ✘

How can I fix this problem?


Solution

  • As explained by the message, ts-loader has a peer dependency on webpack. Hence you must add webpack to your dependencies.