Building SSR project using NodeJS v18.19.0 fails with obscure error message An unexpected error occurred: [object Object] #26648
Labels
angular/build:application
area: @angular-devkit/build-angular
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I initially found out about this bug while successfully building locally my SSR project using v18.14.2 and when building in github workflow ubuntu runner using v18.x which defaulted to v18.19.0. When I switched locally to the same version v18.19.0 I got the same error. Switching the github workflow to use v18.14.2 was a valid workaround. I am reporting this issue in case there is a hidden issue that Node v18.19.0 unhid.
I tried it with a vanilla project and the error is easily replicated. Here are the steps to replicate:
Here is the log of my local execution with both v18.14.2 and v18.19.0 showing that the build works in one and not in the other.
developer ~ Develop Projects npx @angular/cli new --ssr
? What name would you like to use for the new workspace and initial project? test-node
? Which stylesheet format would you like to use? CSS
CREATE test-node/README.md (1062 bytes)
CREATE test-node/.editorconfig (274 bytes)
CREATE test-node/.gitignore (548 bytes)
CREATE test-node/angular.json (2753 bytes)
CREATE test-node/package.json (1272 bytes)
CREATE test-node/tsconfig.json (903 bytes)
CREATE test-node/tsconfig.app.json (324 bytes)
CREATE test-node/tsconfig.spec.json (273 bytes)
CREATE test-node/server.ts (1703 bytes)
CREATE test-node/.vscode/extensions.json (130 bytes)
CREATE test-node/.vscode/launch.json (470 bytes)
CREATE test-node/.vscode/tasks.json (938 bytes)
CREATE test-node/src/main.ts (250 bytes)
CREATE test-node/src/favicon.ico (15086 bytes)
CREATE test-node/src/index.html (294 bytes)
CREATE test-node/src/styles.css (80 bytes)
CREATE test-node/src/main.server.ts (264 bytes)
CREATE test-node/src/app/app.component.css (0 bytes)
CREATE test-node/src/app/app.component.html (20884 bytes)
CREATE test-node/src/app/app.component.spec.ts (925 bytes)
CREATE test-node/src/app/app.component.ts (367 bytes)
CREATE test-node/src/app/app.config.ts (321 bytes)
CREATE test-node/src/app/app.routes.ts (77 bytes)
CREATE test-node/src/app/app.config.server.ts (350 bytes)
CREATE test-node/src/assets/.gitkeep (0 bytes)
✔ Packages installed successfully.
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m
Successfully initialized git.
✔ Packages installed successfully.
developer ~ Develop Projects cd test-node/
developer master ~ Develop Projects test-node node -v
v18.19.0
developer master ~ Develop Projects test-node npm run build
An unexpected error occurred: [object Object]
developer master ~ Develop Projects test-node 1 nvm use v18.14.2
Now using node v18.14.2 (npm v9.6.0)
developer master ~ Develop Projects test-node node -v
v18.14.2
developer master ~ Develop Projects test-node npm run build
Prerendered 1 static route.
Initial Chunk Files | Names | Raw Size | Estimated Transfer Size
main-SS6UDOSF.js | main | 204.02 kB | 56.57 kB
polyfills-LZBJRJJE.js | polyfills | 32.69 kB | 10.59 kB
styles-5INURTSO.css | styles | 0 bytes | 0 bytes
Application bundle generation complete. [15.972 seconds]
developer master ~ Develop Projects test-node 1 npx ng version
/ △ \ | '_ \ /
| | | | |/ _
| '__| | | | | | |/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
Angular CLI: 17.0.6
Node: 18.14.2
Package Manager: npm 9.6.0
OS: linux x64
Angular: 17.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr
Package Version
@angular-devkit/architect 0.1700.6
@angular-devkit/build-angular 17.0.6
@angular-devkit/core 17.0.6
@angular-devkit/schematics 17.0.6
@schematics/angular 17.0.6
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
the generated package.json is untouched:
{
"name": "test-node",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"serve:ssr:test-node": "node dist/test-node/server/server.mjs"
},
"private": true,
"dependencies": {
"@angular/animations": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/forms": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"@angular/platform-server": "^17.0.0",
"@angular/router": "^17.0.0",
"@angular/ssr": "^17.0.6",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.6",
"@angular/cli": "^17.0.6",
"@angular/compiler-cli": "^17.0.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~5.1.0",
"@types/node": "^18.18.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.2.2"
}
}
Minimal Reproduction
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: