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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn berry PnP - ng serve fails for new project #22386

Closed
1 of 15 tasks
Person-93 opened this issue Dec 16, 2021 · 2 comments
Closed
1 of 15 tasks

Yarn berry PnP - ng serve fails for new project #22386

Person-93 opened this issue Dec 16, 2021 · 2 comments

Comments

@Person-93
Copy link

馃悶 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

The angular CLI produces projects that don't work with yarn PnP even after following the steps described at #16980.

馃敩 Minimal Reproduction

  • ng new test-project --skip-git --skip-install --defaults
  • cd test-project
  • yarn set version berry
  • yarn add -D @yarnpkg/pnpify
  • yarn unplug -R @angular/*
  • yarn unplug -R @angular-devkit/*
  • yarn pnpify ng serve

馃敟 Exception or Error


An unhandled exception occurred: Cannot find package '@angular/compiler-cli' imported from /[redacted]/test-project/.yarn/unplugged/@angular-devkit-build-angular-virtual-032fd50c3d/node_modules/@angular-devkit/build-angular/src/utils/load-esm.js
Did you mean to import @angular-compiler-cli-virtual-76b21e31a9/node_modules/@angular/compiler-cli/bundles/index.js?
See "/tmp/ng-daXJrV/angular-errors.log" for further details.

Here's the referenced log file:

[error] Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@angular/compiler-cli' imported from /[redacted]/test-project/.yarn/unplugged/@angular-devkit-build-angular-virtual-032fd50c3d/node_modules/@angular-devkit/build-angular/src/utils/load-esm.js
Did you mean to import @angular-compiler-cli-virtual-76b21e31a9/node_modules/@angular/compiler-cli/bundles/index.js?
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:884:9)
    at moduleResolve (node:internal/modules/esm/resolve:929:18)
    at defaultResolve (node:internal/modules/esm/resolve:1044:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
    at ESMLoader.import (node:internal/modules/esm/loader:276:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1041:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:437:21)
    at importModuleDynamically (node:vm:381:46)

馃實 Your Environment


Angular CLI: 13.1.2
Node: 16.13.1
Package Manager: yarn 3.1.1
OS: linux x64

Angular: 13.1.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.2 (cli-only)
@angular-devkit/build-angular   13.1.2
@angular-devkit/core            13.1.2 (cli-only)
@angular-devkit/schematics      13.1.2 (cli-only)
@angular/cli                    13.1.2
@schematics/angular             13.1.2 (cli-only)
rxjs                            7.4.0
typescript                      4.5.4

Anything else relevant?

@alan-agius4
Copy link
Collaborator

This is because currently Yarn PNP doesn't support ESM and only works with the legacy Node.JS module system CommonJs.

ESM experimental support will available in Yarn PNP 3.2. For more context please see yarnpkg/berry#638 and yarnpkg/berry#2161. At this point this is not actionable by us.

Let's continue tracking Yarn PNP support in #16980.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants