3
votes

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

1
What do you get if you run npm install --save-dev @angular/cli@latest ?D Malan
@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

1 Answers

3
votes

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.