Description
Command
add
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The ng add @angular/ssr command consistently fails when trying to add server-side rendering to an existing Angular 19.2.14 project. The error occurs during the package loading
phase, specifically in the @listr2/prompt-adapter-inquirer dependency.
Root Cause Analysis
The issue appears to be in the @listr2/[email protected] package that's a dependency of @angular/[email protected]. The error occurs at line 30:62 in the compiled JavaScript
where it's trying to extend a class that's undefined.
This suggests:
- Missing or incompatible inquirer dependency
- Version mismatch between @listr2/prompt-adapter-inquirer and its peer dependencies
- Potential ESM/CommonJS module resolution issue
Minimal Reproduction
Steps to Reproduce
- Create an Angular 19.2.14 project or use existing one
- Run ng add @angular/ssr --project=
- Error occurs during "Loading package information from registry" phase
Workaround
The issue can be bypassed by:
- Manually installing @angular/ssr via npm install @angular/ssr --legacy-peer-deps
- Manually creating the required SSR configuration files following the documentation
- Updating angular.json manually for SSR build configuration
Expected Behavior
The ng add @angular/ssr command should successfully add server-side rendering support to the project without errors.
Exception or Error
Error Details
$ ng add @angular/ssr --project=marketplace-app
✔ Determining Package Manager
› Using package manager: npm
✔ Searching for compatible package version
› Found compatible package version: @angular/[email protected].
✔ Loading package information from registry
✖ Class extends value undefined is not a constructor or null
An unhandled exception occurred: Class extends value undefined is not a constructor or null
See "/tmp/ng-xYMb4w/angular-errors.log" for further details.
Error Log Contents:
[error] TypeError: Class extends value undefined is not a constructor or null
at Object. (/home/ubuntu/xxxxx/node_modules/@listr2/prompt-adapter-inquirer/dist/index.cjs:30:62)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Module.require (node:internal/modules/cjs/loader:1487:12)
at require (node:internal/modules/helpers:135:16)
at /home/ubuntu/xxxxx/node_modules/@angular/cli/src/commands/add/cli.js:265:108
Your Environment
Environment
- Angular CLI: 19.2.14
- Angular: 19.2.14
- Node: (include your version)
- Package Manager: npm
- OS: Linux (WSL2)
- Project: Multi-project workspace with existing Angular 19.2.14 applications
Anything else relevant?
Additional Context
- This issue persists even after clearing npm cache and reinstalling Angular CLI
- The error is consistent across multiple attempts
- Using --legacy-peer-deps for other npm operations works fine
- The project has some Angular 18-compatible dependencies that were temporarily removed to isolate the issue
Relevant Repository: https://github.com/angular/angular-cli
Component: ng add command / SSR schematic