question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blocked esbuild.exe executable breaks Angular projects

See original GitHub issue

🐞 Bug report

The issue originates in esbuild (see: https://github.com/evanw/esbuild/issues/1561), but since Angular adopted esbuild as part of build system it stopped companies with strict binary execution policy on Windows to continue updating Angular projects.

Command (mark with an x)

  • new (as it does installation of dependencies, postinstall fails)
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

In some scope, yes. Earlier versions of Angular do not use esbuild and because of that the issue does not exist in Angular workspaces.

Description

On Windows machines with restricted binary execution policy (quite common setup in enterprise companies) execution of esbuild.exe is being blocked. This results in (1) failed postinstall and (2) failure to build projects.

Postinstall failure: image

esbuild comes as a transitive dependency from Angular: image

Build failure (output is full of identical errors): image

Executable is blocked: image

🔬 Minimal Reproduction

Ideas to reproduce similar behaviour:

  • Block execution of esbuild.exe on Windows (?)
  • Corrupt esbuild.exe so that it would fail to run mimicking blocked execution

🌍 Your Environment


$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.2.3
Node: 14.17.0
Package Manager: npm 6.14.13
OS: win32 x64

Angular: 12.2.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router, upgrade

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.3
@angular-devkit/build-angular   12.2.3
@angular-devkit/core            12.2.3
@angular-devkit/schematics      12.2.3
@angular/flex-layout            12.0.0-beta.34
@angular/localize               12.1.1
@schematics/angular             12.1.4
ng-packagr                      12.1.2
rxjs                            6.6.7
typescript                      4.3.5



Anything else relevant?

Ideas how this issue could be solved:

  • Angular could provide an option to fallback to esbuild-wasm. Ideally, the fallback should happen only on Windows and other environments could benefit from full potential of esbuild.
  • Support esbuild project to code sign executable (More info: https://github.com/evanw/esbuild/issues/1561). Having code signed executable would provide a way for companies to create execution exception rules for all future versions of esbuild.exe.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Sep 9, 2021

As a workaround if you use Yarn, you can use “resolutions”

"resolutions": {
  // Note: this has to match the esbuild version in @angular-devkit/build-angular/package.json
  "esbuild@0.12.18": "npm:esbuild-wasm@0.12.18"
}
0reactions
angular-automatic-lock-bot[bot]commented, Oct 23, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to build angular cli application with esbuild
Are you curious if it's possible to build ng-cli generate application with esbuild - js bundling tool that is gaining popularity because of ......
Read more >
esbuild - ng Build failing on angular 12.2.2 - Stack Overflow
I created a project using Angular 12 and everything works fine. However, I get an issue when I try to build the project....
Read more >
Some notes on using esbuild - Hacker News
It works and if something breaks I know how to solve it. For the kind of JS projects that I work on, learning...
Read more >
esbuild-android-arm64 | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found