Each time I use angular/cli
to create a new project by launching the following command
ng new Project-Name
I get the following error
npm ERR. Unexpected end of JSON input while parsing near '..,-4","@angular/common"'
I tried to force clean the cache and re-try but still face the same problem.
NodeJS version: 12.16.3
npm version: 6.14.4
Angular CLI version: 9.1.4
OS: Windows 10 Home win32 x64
Edit: All the commands above I run them in Powershell as administrator
This is not a definitive answer but it looks like your global packages are corrupted in some way.
This bug may be caused by many different things. I suggest doing the following.
10.16.1
. This is enough for angular 9 and from my experience it is the most stable version for development. This should also change your NPM version so that may also help.npm uninstall -g @angular/cli
npm cache clean --force
npm cache verify
npm install -g @angular/cli@<your-version>
If this don't solve the problem try to manually locate the package.json file that is throwing an error and investigate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.