Angular project creation failed because of deprecated circular-json

Viewed 1563

I used following command to create new angular project

ng new hello-world

It failed showing

npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '...rocess":"~0.7.0"},"_h'

Then I installed flatted using...

npm i flatted

But the error still occurs. How to use flatted instead of deprecated library circular-json?

3 Answers

Run following commands that will clean NPM cache

npm cache clean --force

after this run following command

npm install -g @angular/cli@latest

then you can create angular project.

If it doesn't work, even after clearing the cache, which happened in my case:

Make sure you try the ng new create-app command using Powershell in administrator mode.

This worked for me.

I had the same problem. None of the above mentioned answers worked for me.

So I removed the content of .npmrc, ran the generate command and it worked.

After that, you can restore the content of your .npmrc if needed.

Related