3

When updating angular cli in project root folder I run into an error.

Running this command: ng update @angular/cli

returns the following error

Error: Cannot find module '@angular-devkit/schematics/tasks'
Cannot find module '@angular-devkit/schematics/tasks'

I tried removing node modules file then run npm install, also tried running npm i @angular-devkit/schematics but the error persists.

local CLI version: 1.7.4, global CLI version: 7.3.7

nimrutta
  • 31
  • 1
  • 5
  • 1
    What do you get if you run `npm install --save-dev @angular/cli@latest ` ? – D Malan Apr 03 '19 at 15:09
  • https://github.com/angular/angular-cli/issues/9307#issuecomment-359264655 – Yug Singh Apr 03 '19 at 18:08
  • 1
    @Delena Malan Running `npm install --save-dev @angular/cli@latest` successfully upgraded local cli to version **7.3.7**. However I still needed to run `ng update @angular/cli` to migrate workspace configuration to angular.json format as I am updating the project from angular 5.0 to angular 7.2. This time the error didn't reoccur, got a different error **Unknown option: '--sourcemap'**. Changing sourceMap configuration in angular.json fixed it, thus I've successfully updated my project. I appreciate your assistance, thank you! – nimrutta Apr 03 '19 at 19:02
  • Possible duplicate of [Cannot find module '@angular-devkit/core'](https://stackoverflow.com/questions/48394003/cannot-find-module-angular-devkit-core) – ymssa___ Apr 04 '19 at 18:03

1 Answers1

3

Run npm update -g @angular/cli then add '^' before the version clousre like follows

"@angular/cli": "^1.7.4"

Delete package-lock.json file and node_modules directory. Then run npm i or use npm update to update your workspace.

ymssa___
  • 993
  • 9
  • 16