Angular Cannot find module ‘@angular-devkit/core’Nikhil
Hey Angular Ninjas,
Did you recently get the Cannot find module ‘@angular-devkit/core error when you tried to serve your Angular Application? Or may be you tried to evaluate How hard can it be to learn Angular 5 and stumbled across this error in the early stages.
Either way, I came across the same darn error among other issues. So I thought I would share a fix with the community 🙂
Following is a snap of the error in the Git Bash (I love Git Bash for Windows, do you? Let me know in the comments down below):
I have simplified the steps to overcome the missing core module error so that you can follow along more clearly:
- Update Angular CLI globally using the command below:
npm update -g @angular/cli
- Go into your project directory and update the below line in package.json file as below:
(The symbol ^ is very important because it updates the Angular CLI to the latest minor release)
- Now update your dependencies using the below command:
Other Solution for this angular error:
You could as well just install the missing core module in your project’s Dev dependencies with the following command:
npm i -D @angular-devkit/core
Keeping beginners in mind, the command is explained below for simplicity:
- The i option stands for install. Hence npm i translates to npm install
- The -D is a flag which is a shorthand notation for –save-dev. This option installs the package as a part of dev-dependencies. In other words, instead of adding this package to the list of dependencies, it adds it to the list of dev-dependencies in package.json file.
- So, the command in its full form would translate to
npm install --save-dev @angular-devkit/core
And that’s it. You should be good to go now. Fire up that angular serve command and you should see your angular app up and running in a few seconds 🙂
Please share this with your other developer friends if you found it helpful.