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

Angular 17 Issues #2722

Closed
A065639 opened this issue Nov 15, 2023 · 14 comments · Fixed by #2725
Closed

Angular 17 Issues #2722

A065639 opened this issue Nov 15, 2023 · 14 comments · Fixed by #2725
Labels

Comments

@A065639
Copy link

A065639 commented Nov 15, 2023

Type of Issue

[ X ] Bug Report
[ ] Feature Request

Description

Unable to complete a containerized AzDO pipeline build after the Angular 17 and ng-packagr version 17 upgrade.

How To Reproduce

We have a Angular repo that is a library we publish to our internal package hosting library. We use ng-packagr to help accomplish this task. After the recent upgrade, we are able to build locally without issue. We can even create and install the library locally. However, when we attempt to run a CI/CD build we receive failures (shown below).

We build our package locally using a Windows machine, the missing package is specific to a Linux environment so we cannot install it locally. We can force it to be installed during our CI/CD pipeline in the DOCKER file but this feels like a hacky way to accomplish this task.

Curious if others have had this issue or if we are doing something wrong.

`Cannot find module '@rollup/rollup-linux-x64-gnu'
Require stack:

  • /opt/app-root/src/node_modules/ng-packagr/node_modules/rollup/dist/native.js
  • /opt/app-root/src/node_modules/ng-packagr/node_modules/rollup/dist/shared/parseAst.js
  • /opt/app-root/src/node_modules/ng-packagr/node_modules/rollup/dist/shared/rollup.js
  • /opt/app-root/src/node_modules/ng-packagr/node_modules/rollup/dist/rollup.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/flatten/rollup.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/ng-package/entry-point/write-bundles.transform.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/ng-package/entry-point/write-bundles.di.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/ng-package/entry-point/entry-point.di.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/packagr.js
  • /opt/app-root/src/node_modules/ng-packagr/lib/commands/build.command.js
  • /opt/app-root/src/node_modules/ng-packagr/public_api.js
  • /opt/app-root/src/node_modules/@angular-devkit/build-angular/src/builders/ng-packagr/index.js
  • /opt/app-root/src/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
  • /opt/app-root/src/node_modules/@angular-devkit/architect/node/index.js
  • /opt/app-root/src/node_modules/@angular/cli/src/command-builder/architect-base-command-module.js
  • /opt/app-root/src/node_modules/@angular/cli/src/command-builder/architect-command-module.js
  • /opt/app-root/src/node_modules/@angular/cli/src/commands/build/cli.js
  • /opt/app-root/src/node_modules/@angular/cli/src/commands/command-config.js
  • /opt/app-root/src/node_modules/@angular/cli/src/command-builder/command-runner.js
  • /opt/app-root/src/node_modules/@angular/cli/lib/cli/index.js
  • /opt/app-root/src/node_modules/@angular/cli/lib/init.js
    `

Version Information

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

Angular CLI: 17.0.0
Node: 18.18.2
Package Manager: npm 9.8.1
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0
@angular-devkit/build-angular   17.0.0
@angular-devkit/core            17.0.0
@angular-devkit/schematics      17.0.0
@angular/cdk                    17.0.0
@angular/cli                    17.0.0
@angular/material               17.0.0
@schematics/angular             17.0.0
ng-packagr                      17.0.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2


_Please include all version numbers that might be relevant, e.g. third-party libraries_
@alan-agius4
Copy link
Member

That is strange as the mentioned package is published on NPM (https://www.npmjs.com/package/@rollup/rollup-linux-x64-gnu)

Are you consuming packages directly from the public NPM registry or you have a proxy or maybe caching node_modules that might be out of sync?

@JoostK
Copy link
Member

JoostK commented Nov 15, 2023

I suspect what is happening is that you're perhaps installing from Windows, then copying to inside a Docker container. That is a problem, since various dependencies download native binaries depending on the platform they are installed on.

Some package managers allow to download optional dependencies for multiple platforms (recently released in a pnpm update, I don't know about support in other package managers), but that may still pose problems for packages that use postinstall scripts to download native binaries itself, like the node-gyp ecosystem.

@A065639
Copy link
Author

A065639 commented Nov 15, 2023

That is strange as the mentioned package is published on NPM (https://www.npmjs.com/package/@rollup/rollup-linux-x64-gnu)

Are you consuming packages directly from the public NPM registry or you have a proxy or maybe caching node_modules that might be out of sync?

We are using a proxy but I verified the package is in the registry and can be installed directly within a Linux container.

@A065639
Copy link
Author

A065639 commented Nov 15, 2023

I suspect what is happening is that you're perhaps installing from Windows, then copying to inside a Docker container. That is a problem, since various dependencies download native binaries depending on the platform they are installed on.

Some package managers allow to download optional dependencies for multiple platforms (recently released in a pnpm update, I don't know about support in other package managers), but that may still pose problems for packages that use postinstall scripts to download native binaries itself, like the node-gyp ecosystem.

This is what I suspect as well, not sure how to get around this one at the moment as we will always build our applications using Windows machines then build and deploy them using Linux containers. To my knowledge, this is the first time we have encountered such an issue.

@alan-agius4
Copy link
Member

Is the npm installation being done on the Linux container or node_modules are being copied over from Windows?

@A065639
Copy link
Author

A065639 commented Nov 15, 2023

Is the npm installation being done on the Linux container or node_modules are being copied over from Windows?

In the Linux container we were originally calling "npm ci" which would install what is in our package-lock.json created on a Windows machine.

I tried removing the package-lock.json and running "npm i" to install packages and create the package-lock.json in the Linux container but I got the same result. We are digging into the logging here to see what was installed during this build.

@A065639
Copy link
Author

A065639 commented Nov 20, 2023

We continue to dig into this one but with no luck. We suspect that our developers are no longer able to share a package-lock.json file across Windows/Linux environments which presents challenges.

It feels like this reduces the compatibility of the ng-packagr package, is there a better way to integrate rollup into this package? rollup-wasm?

Is this a bug in the latest rollup migration from 3 > 4?

@alan-agius4
Copy link
Member

Yeah, this does appear to be a problem caused by Rollup version 4. Using @rollup/wasm-node should solve the problem.

@A065639
Copy link
Author

A065639 commented Nov 20, 2023

Is this something the group could implement within ng-packgr?

alan-agius4 added a commit to alan-agius4/ng-packagr that referenced this issue Nov 20, 2023
In some cases the native rollup binary are not available which will cause rollup to exit with errors like `Cannot find module @rollup/rollup-linux-x64-gnu`

Closes ng-packagr#2722
@alan-agius4
Copy link
Member

I have a PR in flight to fix this. #2725

@A065639
Copy link
Author

A065639 commented Nov 20, 2023

Fantastic! I look forward to testing it out!

alan-agius4 added a commit to alan-agius4/ng-packagr that referenced this issue Nov 20, 2023
In some cases the native rollup binary are not available which will cause rollup to exit with errors like `Cannot find module @rollup/rollup-linux-x64-gnu`

Closes ng-packagr#2722
alan-agius4 added a commit that referenced this issue Nov 20, 2023
In some cases the native rollup binary are not available which will cause rollup to exit with errors like `Cannot find module @rollup/rollup-linux-x64-gnu`

Closes #2722
alan-agius4 added a commit that referenced this issue Nov 20, 2023
In some cases the native rollup binary are not available which will cause rollup to exit with errors like `Cannot find module @rollup/rollup-linux-x64-gnu`

Closes #2722

(cherry picked from commit 1ed0dc9)
@alan-agius4
Copy link
Member

Released as 17.0.2

@A065639
Copy link
Author

A065639 commented Nov 20, 2023

Fantastic! I was able to pull it in and build. We will continue verification but for now, this is progress and considered resolved.

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.

This action has been performed automatically by a bot.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants