0

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 bold of '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

enter image description here

5
  • Have you tried deleting package-lock.json or yarn.lock and the node_modules and reinstalling them? Commented Feb 23, 2018 at 10:24
  • There are no such folders by that names ... Commented Feb 23, 2018 at 10:32
  • Just delete lock.json files and node_modules as suggested by @ArjunPanicker and re-install node_modules. Commented Feb 23, 2018 at 10:36
  • Try taking your cli version back to 1.5.x Commented Feb 23, 2018 at 10:49
  • Go to ur project's root folder and delete the files named - package-lock.json, yarn.lock(if exists) and delete the folder called node_modules. Then do npm install again in the root folder of the project. Commented Feb 23, 2018 at 11:20

1 Answer 1

1

Do this.

npm uninstall @angular/cli
npm install @angular/[email protected]

Then try again generating your component

Another Solution

As i can see that your animation module is on Angular 4

If above method does not work change the version of the angular/cli to 1.4.10

npm uninstall @angular/cli
npm install @angular/[email protected]

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.