Skip to content

ng build not working with pnpm #21622

@hungtcs

Description

@hungtcs

🐞 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

Without any file changes, the file sizes generated by the first build and the second build are inconsistent.

And the file generated by the first build does not work, error message is:

image

The second and subsequent builds are working well.

🔬 Minimal Reproduction

The steps:

  1. npm install -g pnpm
  2. ng new --package-manager pnpm --skip-git --skip-install --skip-tests --strict --style scss pnpm-test
  3. cd pnpm-test
  4. pnpm install
  5. pnpm run build (first build)
  6. pnpm run build (build again)

the first build output:
image

the second build output:
image

🔥 Exception or Error

ERROR TypeError: Cannot read property '11' of null
    at Xl (main.411f6f6ec351866530d7.js:1)
    at template (main.411f6f6ec351866530d7.js:1)
    at ir (main.411f6f6ec351866530d7.js:1)
    at nr (main.411f6f6ec351866530d7.js:1)
    at ur (main.411f6f6ec351866530d7.js:1)
    at main.411f6f6ec351866530d7.js:1
    at nr (main.411f6f6ec351866530d7.js:1)
    at Vs.create (main.411f6f6ec351866530d7.js:1)
    at t.bootstrap (main.411f6f6ec351866530d7.js:1)
    at main.411f6f6ec351866530d7.js:1

🌍 Your Environment

Angular CLI: 12.0.5
Node: 14.16.1
Package Manager: pnpm 6.13.0
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.5 (cli-only)
@angular-devkit/build-angular   12.0.5
@angular-devkit/core            12.0.5 (cli-only)
@angular-devkit/schematics      12.0.5 (cli-only)
@schematics/angular             12.0.5 (cli-only)
rxjs                            6.6.7
typescript                      4.2.4

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions