Angular Cannot find module ‘@angular-devkit/core’

Angular Cannot find module ‘@angular-devkit/core’

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):

Angular Error: Cannot find module '@angular-devkit/core

Angular Error: Cannot find module ‘@angular-devkit/core

I have simplified the steps to overcome the missing core module error so that you can follow along more clearly:

  1. Update Angular CLI globally using the command below:
    npm update -g @angular/cli
  2. Go into your project directory and update the below line in package.json file as below:
    "@angular/cli": "^1.7.2"

    (The symbol ^ is very important because it updates the Angular CLI to the latest minor release)

  3. Now update your dependencies using the below command:
    npm update

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:

  1. The i option stands for install. Hence npm i translates to npm install
  2. 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.
  3. 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.


Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *