Skip to content

Issue with ng new for SSR Configuration and ng add @angular/ssr Not Updating package.json File for serve in prod #26315

@djouf007

Description

@djouf007

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Hello all,

As the title indicates, the ng new command for SSR configuration and ng add @angular/ssr do not add the server line in the scripts section of package.json for production.

Here is the scripts JSON:

"scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" }
Here is what I manually added:

"serve:ssr": "node dist/server/server.mjs"
Here is my complete package.json:

{ "name": "site", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "serve:ssr": "node dist/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.0", "@angular/cdk": "17.0.0", "@angular/google-maps": "^17.0.0", "@angular/material": "^17.0.0", "@angular/material-moment-adapter": "^17.0.0", "@ngx-translate/core": "^15.0.0", "@ngx-translate/http-loader": "^8.0.0", "js-sha256": "^0.10.1", "ngx-cookie-service": "^17.0.0", "express": "^4.18.2", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.14.2" }, "devDependencies": { "@angular-devkit/build-angular": "^17.0.0", "@angular/cli": "^17.0.0", "@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" } }

Please provide a link to a minimal reproduction of the bug

ng new test (in ssr) or ng add @angular/ssr

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.0
Node: 18.16.1
Package Manager: npm 9.5.1
OS: linux x64

Angular: 17.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... 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/google-maps               17.0.0
@angular/material                  17.0.0
@angular/material-moment-adapter   17.0.0
@angular/ssr                       17.0.0
@schematics/angular                17.0.0
rxjs                               7.8.1
typescript                         5.2.2
zone.js                            0.14.2

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions