angularangular9angular10angular-upgrade

Getting Error - Migration failed: Package "@angular/core" was not found on the registry


Trying to update Angular 9 to Angular 10, getting below error -

× Migration failed: Package "@angular/core" was not found on the registry.

Cannot continue as this may be an error.

See "C:.........\Local\Temp\ng-j24yaY\angular-errors.log" for further details.

Error message in log file -

[error] Error: Package "@angular/core" was not found on the registry. Cannot continue as this may be an error. at C:\libs\node-libs\node_modules@angular\cli\node_modules@schematics\update\update\index.js:642:27 at Array.reduce () at C:\libs\node-libs\node_modules@angular\cli\node_modules@schematics\update\update\index.js:634:54 at processTicksAndRejections (internal/process/task_queues.js:93:5)

My package looks like below - Package.json


{
  "name": "ng4",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build-prod": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ngcc"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/schematics": "0.0.34",
    "@angular/animations": "9.1.13",
    "@angular/common": "9.1.13",
    "@angular/compiler": "9.1.13",
    "@angular/core": "9.1.13",
    "@angular/forms": "9.1.13",
    "@angular/http": "4.4.5",
    "@angular/platform-browser": "9.1.13",
    "@angular/platform-browser-dynamic": "9.1.13",
    "@angular/router": "9.1.13",
    "@ngrx/core": "1.2.0",
    "@ngrx/effects": "4.1.1",
    "@ngrx/store": "4.1.1",
    "@types/lodash": "4.14.85",
    "angular-sanitize": "^1.8.0",
    "bootstrap": "^3.4.1",
    "classlist.js": "1.1.20150312",
    "core-js": "2.4.1",
    "decode-html": "^2.0.0",
    "font-awesome": "4.7.0",
    "immutable": "3.8.2",
    "jquery": "3.2.1",
    "lodash": "4.17.4",
    "moment": "2.20.1",
    "ngx-bootstrap": "2.0.5",
    "ngx-logger": "1.1.2",
    "rxjs": "6.6.2",
    "rxjs-compat": "^6.6.7",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.15",
    "@angular/cli": "^9.1.15",
    "@angular/compiler-cli": "9.1.13",
    "@angular/language-service": "9.1.13",
    "@types/jasmine": "2.5.53",
    "@types/jasminewd2": "2.0.2",
    "@types/jquery": "3.2.16",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "2.6.2",
    "jasmine-spec-reporter": "4.1.0",
    "karma": "1.7.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "1.2.1",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.1.2",
    "ts-node": "3.2.0",
    "tslint": "5.7.0",
    "typescript": "^3.8.3"
  }
}

Can you please guide me, what's going wrong.


Solution

  • I was able to solve the issue why doing

    npm cache clean --force
    

    deleting the whole node_module folder

    and then

    npm install
    ng update @angular/core --force