VSCode cannot find module '@angular/core' or any other modules

AngularVisual Studio-Code

Angular Problem Overview

My project was generated with Angular CLI version 1.2.6.

I can compile the project and it works fine, but I always get error in VSCode telling me:

> cannot find module '@angular/core' > cannot find module '@angular/router' > cannot find module .....

screenshot screenshot

I have attached content of my tsconfig.json file this has been really frustrating for me, spending 2 hours to figure out what is wrong, I have also uninstalled and reinstalled the VSCode it doesn't work.

Here is my environment specification:

@angular/cli: 1.2.6
node: 6.9.1
os: win32 x64
@angular/animations: 4.3.4
@angular/common: 4.3.4
@angular/compiler: 4.3.4
@angular/core: 4.3.4
@angular/forms: 4.3.4
@angular/http: 4.3.4
@angular/platform-browser: 4.3.4
@angular/platform-browser-dynamic: 4.3.4
@angular/router: 4.3.4
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.4
@angular/language-service: 4.3.4

OS: Microsoft vs 10 enterprise

project root folder


node_modules folder



  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
    "lib": [

Angular Solutions

Solution 1 - Angular

I was facing this issue only while importing my own created components/services For those of you like me, for whom the accepted solution did not work, can try this:


"baseUrl": "src"

in your tsconfig.json. The reason is that visual code IDE is unable to resolve the base url so is unable to resolve path to imported components and gives error/warning.

Whereas angular compiler takes src as baseurl by default so it is able to compile.


You need to restart VS Code IDE to make this change come into effect.


As mentioned in one of the comments, in some cases changing workspace version might also work. More details here: https://github.com/Microsoft/vscode/issues/34681#issuecomment-331306869

Solution 2 - Angular

Most likely missing node_modules package in the angular project, run:

npm install

inside the angular project folder.

Solution 3 - Angular

Visual Code restart is needed if any update or install or clear cache

Solution 4 - Angular

the fix for me was to run

npm install

and then unload,then reload the project in visual studio.

Solution 5 - Angular

I was facing this issue in my angular 5 application today. And the fix which helped me, was simple. I added "moduleResolution": "node" to the compilerOptions in the tsconfig.json file. My complete tsconfig.json file content is below.

  "compileOnSave": false,  
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
    "lib": [

The moduleResolution specify module resolution strategy. The value of this settings can be node or classic. You may read more about this here.

Solution 6 - Angular

Delete Node Modules folder from project folder.Run below command

npm cache clean --force npm install

It should work.

Solution 7 - Angular

I was facing the same issue , there could be two reasons for this-

  1. Your src base folder might not been declared, to resolve this go to tsconfig.json and add the baseUrl as "src"
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "src",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "lib": [
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  1. you might have problem in npm , To resolve this , open your command window and run-npm install

Solution 8 - Angular

Try using:

npm audit fix --force

and then:

npm install --save @ng-bootstrap/ng-bootstrap

instead of saving @ng-bootstrap/ng-bootstrap globally.

Solution 9 - Angular

I had the same problem. I resolved it by clearing npm cache which is at "C:\Users\Administrator\AppData\Roaming\npm-cache"

Or you can simply run:

npm cache clean --force

and then close vscode, and then open your folder again.

Solution 10 - Angular

In the VSCode status bar, it must be showing typescript version - like this

enter image description here

Clicking on that version number will show you this, different versions available.

enter image description here

If you are using the VSCode version then switching to Workspace version solves the problem if it is VScode issue rather than your tsconfig.json (I am already using that one, so not highlighted)

enter image description here

Solution 11 - Angular

You need to install it manually.

$ npm i @angular/core -s

Solution 12 - Angular

I tried a lot of stuff the guys informed here, without success. After, I just realized I was using the Deno Support for VSCode extension. I uninstalled it and a restart was required. After restart the problem was solved.

Solution 13 - Angular

I faced the same problem , As I'm trying to work on angular project in VS code.

The solution for which this issue resolved is .

  1. Delete the node_modules folder if you have one in your project folder

2.run the following command in terminal

npm install

  1. Then Run npm audit fix

  2. Then Run npm audit fix --force

now the issue will be resolved.

Solution 14 - Angular

I uninstalled all extension I had already installed, and it turns out JavaScript and TypeScript IntelliSense extension from below address caused the issue. https://marketplace.visualstudio.com/items?itemName=sourcegraph.javascript-typescript

the point here is when you visit the website you see there is a yellow label, telling you it is in preview release, but when you browse in vs extensions, you don't see that label.

Solution 15 - Angular

this extension https://marketplace.visualstudio.com/items?itemName=sourcegraph.javascript-typescript was causing me the error in visual code, I uninstalled it and it works for me

Solution 16 - Angular

In my case it was a mispelling of the import line. Check that you have spelt the @angular/core part properly if typing it out manually.

import { Component } from '@angular/core';

Solution 17 - Angular

The fix for me was to import the entire project. For those who have this problem in 2019 please check if you have imported the entire project not a part of the project.

Solution 18 - Angular

If you did what I (foolishly) did... Which was drag and drop a component folder into my project then you'll probably be able to solve it by doing what I did to fix it.

Explanation: Basically, by some means Angualar CLI must tell InteliJ what @angular means. If you just plop the file in your project without using the Angular CLI i.e. ng g componentName --module=app.module then Angular CLI doesn't know to update this reference so IntelliJ has no idea what it is.

Approach: Trigger the Angular CLI to update references of @angular. I currently know only one way to do this...

Implementation: Add a new component at the same level as the component your having issues with. ng g tempComponent --module=app.module This should force the Angular CLI to run and update these references in the project. Now just delete the tempComponent you just created and don't forget to remove any reference to it in app.module.

Hope this helps someone else out.

Solution 19 - Angular

I had the same issue, was strange because project compiled and ran without errors. I updated npm and then reinstalled the packages

npm update
npm install

then vs code stop saying that.

Solution 20 - Angular

Most likely npm package is missing. And sometimes npm install does not fix the problem.

I have faced the same and I have solved this issue by deleting the node_modules folder and then npm install

Solution 21 - Angular

I've encountered this problem and fixed it by following commands.

npm cache clean --force
npm i @angular/core -s

And then don't forget to restart your VS code. It must be fixed.

Solution 22 - Angular

Occurs when cloning or opening existing projects in Visual Studio Code. In the integrated terminal run the command npm install

Solution 23 - Angular

Executing the following two commands solves the problem for me:

npm install -g @angular/cli
ng update --all --force

Solution 24 - Angular

for Visual Studio -->

    Seems like you don't have `node_modules` directory in your project folder.
    Execute this command where `package.json` file is located:
     npm install 

Solution 25 - Angular

Try this, it worked for me:

npm i --save @angular/platform-server  

Then reopen VS code

Solution 26 - Angular

This worked for me.

 npm install --save-dev @angular-devkit/build-angular

Solution 27 - Angular

In my case, when i upgrade vs project to angular 10, I had this errors.

Angular cli creates tsconfig.json, tsconfig.base.json and tsconfig.app.json when i delete tsconfig.json and rename tsconfig.base.json to tsconfig.ts all things will Ok. you must also change extends inside tsconfig.app.json to tsconfig.json

Solution 28 - Angular

I had same problems with Sublime Text.

I came up with following solution: I just edited

> tsconfig.json

in the root of Angular workspace to include my freshly created application.

  "files": [],
  "references": [
      "path": "./projects/client/tsconfig.app.json"
      "path": "./projects/client/tsconfig.spec.json"
      "path": "./projects/vehicle-market/tsconfig.app.json"
      "path": "./projects/vehicle-market/tsconfig.spec.json"
      "path": "./projects/mobile-de-lib/tsconfig.lib.json"
      "path": "./projects/mobile-de-lib/tsconfig.spec.json"

Solution 29 - Angular

All you need to do is that you have to include nodes_modules folder in your project. You might face this problem when you clone any project from github through git command line.

Solution 30 - Angular

Do run

npm install 

it will work most of the cases

Solution 31 - Angular

I solved this problem as follow:

  1. Open Visual studio code with your project.
  2. Terminal -> New Terminal.
  3. Write npm install.

Solution 32 - Angular

From my point of view the CLI you are using and the libraries are mismatched. The ionic CLI version 1 cannot build libraries for ionic CLI version 4. The best solution is to try upgrade your CLI version. You can otherwise use nvm which allows you to run multiple node versions on the same O.S. This can help you use different ionic CLI versions across different projects depending on the requirements.

Check out nvm @: Their official windows repo. There is also a MAC and Linux version.

Solution 33 - Angular

If we get this type of error just use the command:

 npm i @anglar/core,
 npm i @angular/common,
 npm i @angular/http,
 npm i @angular/router

After installing this also showing error just remove few words then again add that word its working.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionArashView Question on Stackoverflow
Solution 1 - AngulartryingToLearnView Answer on Stackoverflow
Solution 2 - AngularStefan MiticView Answer on Stackoverflow
Solution 3 - AngularvbrgrView Answer on Stackoverflow
Solution 4 - AngularjbookerView Answer on Stackoverflow
Solution 5 - AngularSibeesh VenuView Answer on Stackoverflow
Solution 6 - AngularKrutiView Answer on Stackoverflow
Solution 7 - AngularAvi SenView Answer on Stackoverflow
Solution 8 - AngulartheChosenOne.DuhView Answer on Stackoverflow
Solution 9 - Angularwaqas.siddView Answer on Stackoverflow
Solution 10 - AngularSanket SardesaiView Answer on Stackoverflow
Solution 11 - AngularPrithiView Answer on Stackoverflow
Solution 12 - AngularJeter Costa e SilvaView Answer on Stackoverflow
Solution 13 - AngularKavyashree B.SView Answer on Stackoverflow
Solution 14 - AngularArashView Answer on Stackoverflow
Solution 15 - AngularMateo RinconView Answer on Stackoverflow
Solution 16 - AngularAdamantusView Answer on Stackoverflow
Solution 17 - AngularMaster rslView Answer on Stackoverflow
Solution 18 - AngularTripp CannellaView Answer on Stackoverflow
Solution 19 - AngularSantiago CeronView Answer on Stackoverflow
Solution 20 - AngularKaziView Answer on Stackoverflow
Solution 21 - AngularSemih Okan PehlivanView Answer on Stackoverflow
Solution 22 - AngularParas RawatView Answer on Stackoverflow
Solution 23 - AngularAbdusSalamView Answer on Stackoverflow
Solution 24 - AngularYodhraj PatilView Answer on Stackoverflow
Solution 25 - AngularVEEZView Answer on Stackoverflow
Solution 26 - AngularSydney_devView Answer on Stackoverflow
Solution 27 - AngularAmir AghajaniView Answer on Stackoverflow
Solution 28 - AngularTorsten BarthelView Answer on Stackoverflow
Solution 29 - AngularAnandView Answer on Stackoverflow
Solution 30 - AngularVinKView Answer on Stackoverflow
Solution 31 - AngularMohamad AlhamidView Answer on Stackoverflow
Solution 32 - AngularSiundu254View Answer on Stackoverflow
Solution 33 - AngularprashanthView Answer on Stackoverflow