1

I'm upgrading my app from Angular 16 => 17. Everything going fine, but when I do npm install and then ng serve I get an error:

An unhandled exception occurred: Cannot find module '@angular/build/package.json'

And if I try to install this lib with npm install --save-dev @angular/build I get a different issue -- a dependency issue. @angular/build requires at least Angular 18.

So how can I run my app on v17?

1 Answer 1

0

Check your angular.json settings for the ng serve command. It turns out, my serve was pointed to another stanza called serve-original since I'm using Module Federation and have migrated to Native Federation.

In that stanza make sure you're pointing to the v17-compatible "@angular-devkit/build-angular" and not the newer "@angular/build"

Change:

                "serve-original": {
                    "builder": "@angular/build:dev-server",

to

                "serve-original": {
                    "builder": "@angular-devkit/build-angular:dev-server",

You should be good to go with ng s for your v17 app.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.