-1

I get this error Cannot find module '@angular/core'. and search SO for help on this and there are questions but nothing helps me.

Does this has to do with wrong version import? In the command windows I run

L:\NetProject\BooksProject\BooksProject\ClientApp>ng build

and get the same error

BooksProject> 
BooksProject> fail: Microsoft.AspNetCore.SpaServices[0]
BooksProject>       ERROR in ../../../node_modules/@angular/cdk/bidi/typings/dir-document-token.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/bidi/typings/dir.d.ts(8,59): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/bidi/typings/directionality.d.ts(8,41): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autofill.d.ts(9,69): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autofill.d.ts(10,28): error TS2307: Cannot find module 'rxjs'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autosize.d.ts(8,71): error TS2307: Cannot find module '@angular/core'.
BooksProject> 

If I debug the app a get browser window with only the text, "Cannot GET /"

I deleted the node_modules folder and did npm install

I run the command after suggestion from @HariniP, Thanks!

npm i @angular/core

And this is the output, do I need to fix all this WARN?

L:\NetProject\BooksProject\BooksProject\ClientApp>npm i @angular/core
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN The package protractor is included as both a dev and production dependency.
npm WARN The package ts-node is included as both a dev and production dependency.
npm WARN The package tslint is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @angular/[email protected]
updated 1 package and audited 19503 packages in 33.58s
found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

L:\NetProject\BooksProject\BooksProject\ClientApp>

2 Answers 2

1

i fixed my problem by adding :

<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators> <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecora

this link might help u TypeScript error

Sign up to request clarification or add additional context in comments.

Comments

0

Install angular by using the command npm i @angular/core in your project directory.

5 Comments

Did you try building after that?
I clean and rebuild project from VS then I get Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped - There are no error, but from windows command prompt i get this initial error and when I debug run
Ok, so VS build succeeded, are you able to view the application in browser?
The browser say only "Cannot GET /", it does not load my Component
in Startup.cs I can place a breakpoint in ConfigureServices and program halts ok, This initial error comes when browser open after like 60 sec of loading, and the only think visible in the browser is "Cannot GET /", in top left corner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.