35
votes
ng update

The "@angular-devkit/schematics" package cannot be resolved from the workspace root directory. This may be due to an unsupported node modules structure. Please remove both the "node_modules" directory and the package lock file; and then reinstall. If this does not correct the problem, please temporarily install the "@angular-devkit/schematics" package within the workspace. It can be removed once the update is complete.

7
If you search for @angular-devkit/schematics using your IDE does it exist anywhere other than package-lock.json?Andrew Allen
@AndrewAllen No I haven't found it.Satish Singh

7 Answers

57
votes

I had this issue

First I ran this to see the structure of the package

npm ls @angular-devkit/schematics

it returned....

[email protected] C:\Users\wgrant\source\repos\WD\MMS\Mms\ClientApp

`-- (empty)

since it was empty I ran the following (if yours is not empty maybe try update instead of install)

npm install @angular-devkit/schematics

and after this, the 'ng update' ran successfuly

35
votes

first use the command

npm remove -g @angular/cli

and then

npm install -g @angular/cli

in my case solved and installed the latest version of the angular

9
votes

In my case, I needed to just run

npm install

then the command

ng update @angular/core @angular/cli 

completed successfully

5
votes

npm install @angular-devkit/schematics

solved the problem for me

3
votes

In my case, I was running the ng update command in a directory which didn't have the package.json. Running the command in correct directory fixed it for me.

0
votes
npm update 

and

npm install 

fixed this issue for me just now.

0
votes
  1. Just Create New Project by using ng new prjName.

  2. Check for @angular-devkit/schematics if not found then run npm install @angular-devkit/schematics

  3. It will install @angular-devkit/schematics if finds any vulnerability just fix them by npm audit fix

  4. Just hit ng update @angular/cli@^10 @angular/core@^10 for specific version (here for version 10) or just run ng update

  5. npm cache clean --force

  6. ng update