I'm trying to add a new component in Asp.Net Core 2.0 SPAs using angular-cli. I added dev dependencies in the project's root folder using
npm install --save-dev @angular/cli@latest
angular-cli version
Angular CLI: 1.7.1; Node: 8.9.4; OS: win32 x64
But when i write ng g c ComponentName this error occurs
C:\Users\USERNAME\source\repos\MyApp\MyApp\node_modules\@angular\cli\upgrade\version.js:12 const { bold, red, yellow } = chalk_1.default; ^
TypeError: Cannot destructure property
boldof 'undefined' or 'null'. at Object. (C:\Users\USERNAME\source\repos\MyApp\MyApp\node_modules\@angular\cli\upgrade\version.js:12:39) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (C:\Users\USERNAME\source\repos\MyApp\MyApp\node_modules\@angular\cli\commands\build.js:4:19) at Module._compile (module.js:643:30)
I saw this solution but none of them worked for me. How to resolve this issue?
Thanks

package-lock.jsonoryarn.lockand thenode_modulesand reinstalling them?package-lock.json,yarn.lock(if exists) and delete the folder callednode_modules. Then donpm installagain in the root folder of the project.