nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.66k stars 2.36k forks source link

Nx can not build Angular v16 library #16661

Closed e-oz closed 1 year ago

e-oz commented 1 year ago

Current Behavior

Nx v16 can not build a library for Angular v16

Expected Behavior

Nx should be able to build an Angular library

GitHub Repo

No response

Steps to Reproduce

  1. package.json:

    "dependencies": {
    "@angular/core": "^16.0.0-rc.3",
    "@ngrx/component-store": "^15.4.0",
    "@ngrx/effects": "^15.4.0",
    "@ngrx/store": "^15.4.0",
    "rxjs": "^7.8.1"
    },
    "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.0-rc.4",
    "@angular-devkit/core": "^16.0.0-rc.4",
    "@angular-devkit/schematics": "^16.0.0-rc.4",
    "@angular/cli": "^16.0.0-rc.4",
    "@angular/common": "^16.0.0-rc.3",
    "@angular/compiler": "^16.0.0-rc.3",
    "@angular/compiler-cli": "^16.0.0-rc.3",
    "@angular/platform-browser": "^16.0.0-rc.3",
    "@angular/platform-browser-dynamic": "^16.0.0-rc.3",
    "@nx/workspace": "16.0.1",
    "@nx/jest": "16.0.1",
    "@nx/angular": "16.0.1",
    "@schematics/angular": "^16.0.0-rc.4",
    "@types/jest": "^29.5.1",
    "@types/node": "^18.16.3",
    "jest": "^29.5.0",
    "jest-environment-jsdom": "^29.5.0",
    "jest-preset-angular": "^13.0.1",
    "ng-packagr": "^16.0.0-rc.1",
    "nx": "16.0.1",
    "postcss": "^8.4.23",
    "postcss-import": "~15.1.0",
    "postcss-preset-env": "~8.3.2",
    "postcss-url": "~10.1.3",
    "ts-jest": "29.1.0",
    "ts-node": "^10.9.1",
    "tslib": "^2.5.0",
    "typescript": "^5.0.4"
    }
  2. nx build --skip-nx-cache --verbose

Nx Report

Node   : 20.0.0
   OS     : darwin arm64
   npm    : 9.6.4
   Hasher : Native

   nx             : 16.0.1
   @nx/js         : 16.0.1
   @nx/jest       : 16.0.1
   @nx/linter     : 16.0.1
   @nx/workspace  : 16.0.1
   @nx/angular    : 16.0.1
   @nx/cypress    : 16.0.1
   @nx/devkit     : 16.0.1
   @nrwl/tao      : 16.0.1
   @nx/webpack    : 16.0.1
   typescript     : 5.0.4
   ---------------------------------------
   Community plugins:
   @ngrx/component-store : 15.4.0
   @ngrx/effects         : 15.4.0
   @ngrx/store           : 15.4.0

Failure Logs

> nx run ngx-collection:build:production

 >  NX   Cannot find module 'ng-packagr/lib/ngc/ngcc-processor'

   Require stack:
   - /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js
   - /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.js
   - /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.js
   - /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/package.impl.js
   - /Users/oz/repos/my/ngx-collection/node_modules/nx/src/config/workspaces.js
   - /Users/oz/repos/my/ngx-collection/node_modules/nx/src/command-line/run.js
   - /Users/oz/repos/my/ngx-collection/node_modules/nx/bin/run-executor.js

Error: Cannot find module 'ng-packagr/lib/ngc/ngcc-processor'
Require stack:
- /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js
- /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.js
- /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.js
- /Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/package.impl.js
- /Users/oz/repos/my/ngx-collection/node_modules/nx/src/config/workspaces.js
- /Users/oz/repos/my/ngx-collection/node_modules/nx/src/command-line/run.js
- /Users/oz/repos/my/ngx-collection/node_modules/nx/bin/run-executor.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at Module._load (node:internal/modules/cjs/loader:928:27)
    at Module.require (node:internal/modules/cjs/loader:1149:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/Users/oz/repos/my/ngx-collection/node_modules/@nx/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js:13:26)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at Module.require (node:internal/modules/cjs/loader:1149:19)

 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target build for project ngx-collection failed

   Failed tasks:

   - ngx-collection:build:production

Additional Information

No response

AgentEnder commented 1 year ago

Hey, Angular v16 support is not quite ready, but should be in 16.1

pumano commented 1 year ago

angular totally remove ngcc since 16 but tools required it somehow. I'm also looking support building libs with Angular 16

e-oz commented 1 year ago

Ok, got it, will wait for 16.1. Thank you.

pumano commented 1 year ago

@AgentEnder could you please provide any ETA for 16.1? Looks like 16 angular comes with amazing features, and we want to use it as soon as possible. Thank you!

AgentEnder commented 1 year ago

I mean, 15.9.2 etc won't support angular 16 either, you should be good to migrate to Nx 16, and then migrate to angular 16 whenever it's ready.

We generally support major angular versions within a few days of their release, and Angular 16 hasn't reached general availability yet

e-oz commented 1 year ago

It means that if a library wants to support the upcoming Angular version ahead of time (with the pre-release tag), this library should not use Nx.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.