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 vs code telling me cannot find mo
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:
Add
"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.
NOTE:
You need to restart VS Code IDE to make this change come into effect.
EDIT:
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
I solved this problem as follow:
npm install
.This worked for me.
npm install --save-dev @angular-devkit/build-angular
Occurs when cloning or opening existing projects in Visual Studio Code. In the integrated terminal run the command npm install
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
Do run
npm install
it will work most of the cases