0

I upgraded my angular project from 12 to 13 using the angular update guide provided here https://angular.io/guide/update-to-latest-version without any issues. But while running the project on my local machine (mac) with "ng serve --open" command its prompts the browser download window instead of running the project. I notice no compilation errors and ng build is successful. I tried deleting and reinstalling node modules but the issue still exists. Here is my package.json file. Any leads are highly appreciated. Thanks.

{
  "name": "dashboard-new11",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^13.1.3",
    "@angular/common": "^13.1.3",
    "@angular/compiler": "^13.1.3",
    "@angular/compiler-cli": "^13.1.3",
    "@angular/core": "^13.1.3",
    "@angular/forms": "^13.1.3",
    "@angular/platform-browser": "^13.1.3",
    "@angular/platform-browser-dynamic": "^13.1.3",
    "@angular/platform-server": "^13.1.3",
    "@angular/router": "^13.1.3",
    "@types/file-saver": "^2.0.1",
    "@types/jest": "^26.0.4",
    "angular-webstorage-service": "^1.0.2",
    "angular2-toaster": "^11.0.1",
    "core-js": "^2.4.1",
    "ngx-bootstrap": "^7.1.2",
    "ngx-webstorage-service": "^4.1.0",
    "node": "^14.15.1",
    "pako": "^1.0.11",
    "rxjs": "^6.6.7",
    "rxjs-compat": "^6.5.2",
    "tslib": "^2.0.0",
    "typescript": "4.5.4",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.1.4",
    "@angular/cli": "^13.1.4",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "file-saver": "^2.0.5",
    "karma": "~6.3.9",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "ng-autosize": "^1.1.0",
    "protractor": "~7.0.0",
    "schematics-scss-migrate": "^1.3.14",
    "ts-node": "~2.0.0",
    "tslint": "~6.1.3"
  }
}

Here are the start logs

✔ Browser application bundle generation complete.

Initial Chunk Files   | Names         |  Raw Size
vendor.js             | vendor        |   4.58 MB | 
main.js               | main          |   1.88 MB | 
polyfills.js          | polyfills     | 386.86 kB | 
styles.css, styles.js | styles        | 260.59 kB | 
runtime.js            | runtime       |   6.86 kB | 

                      | Initial Total |   7.10 MB

Build at: 2022-01-20T07:38:36.218Z - Hash: e641c46fc4de7304 - Time: 17292ms

Warning: /Users/TSC/Desktop/Watson360/Backups/Advisor360-UI-Angular13/client/src/app/shared/app.http.service.ts depends on 'pako'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/TSC/Desktop/Watson360/Backups/Advisor360-UI-Angular13/client/src/app/shared/app.messenger.service.ts depends on 'rxjs/Rx'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies



** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


✔ Compiled successfully.
Merna Mustafa
  • 1,235
  • 2
  • 10
  • 22
Durga Prasad
  • 121
  • 1
  • 4
  • 13

1 Answers1

0

I just had the same issue after upgrading to Angular 13.

Please verify what is in angular.json file inside build options section. There you should find the following:

"index": "src/index.html",

I once changed that to "index.aspx" a few years ago because I am doing a large enterprise application within SharePoint, but now that was causing me to have the behavior you described.

Entho
  • 26
  • 2
  • Hi Entho, thanks for the response. I check the angular.json file and Its "index": "src/index.html". But the error exists for me. Did u do any changes? – Durga Prasad Jan 22 '22 at 09:05
  • I dug a little deeper, but unfortunately, I am unable to re-create the problem. Even if I revert all of my changes. What I have also done was following, but maybe these changes did not reflect immediately. 1. Upgrade of global Angular CLI npm cache verify npm install -g @angular/cli@latest 2. Installation and use of node version 16.13.2 – Entho Jan 23 '22 at 14:49
  • Thanks Entho I will try that and let you know – Durga Prasad Jan 25 '22 at 03:06