Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
June 13, 2024
The error “Cannot find module ‘@angular/core'” usually occurs when there is any problem with the module resolution.
Here are some possible solutions that you can try to resolve this issue.
If node_module folder is not present in project then install the dependencies using,
npm install
For yarn,
yarn install
If node_module is already there then, try installing @angular/core manually using the following command;
npm install @angular/core
Sometimes, VSCode needs to be restarted to recognize new modules and updates. Close all instances of VSCode and reopen your project.
In some cases, npm cache can cause the issue. So, try clearing it and reinstall dependencies using,
npm cache clean --force
npm install
For yarn,
yarn cache clean
yarn install
Finally, if none of above works then delete node_modules, package-lock.json and reinstall the dependency using npm install
Check that your tsconfig.json file is properly configured. Sometimes, VSCode fails to resolve the application base URL. As a result, IDE can’t resolve paths to imported components hence results in the error so you may want to set baseUrl option as “src”.
{ "compilerOptions": { "baseUrl": "src", // other options... } }
TypeScript IntelliSense or language service extensions in VS Code can sometimes lead to the error.
If auto-update is enabled for the TypeScript IntelliSense or Angular Language Service extensions, they may sometimes require a hard reload to function correctly.
To do this, follow the steps below: