Bird
0
0

You wrote this import in your Angular component:

medium📝 Debug Q14 of 15
Angular - Standalone Components
You wrote this import in your Angular component:
import { RouterModule } from '@angular/router';

But you get an error saying Cannot find module '@angular/router'. What is the most likely cause?
ARouterModule is not exported from @angular/router
BYou used curly braces incorrectly
CYou need to import RouterModule from @angular/core instead
DYou forgot to install the @angular/router package
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error means the module '@angular/router' is not found in your project dependencies.
  2. Step 2: Identify common cause

    This usually happens if the package is not installed via npm or yarn.
  3. Final Answer:

    You forgot to install the @angular/router package -> Option D
  4. Quick Check:

    Missing package causes module not found error [OK]
Quick Trick: Check if package is installed when module not found [OK]
Common Mistakes:
  • Assuming import syntax is wrong
  • Importing from wrong package
  • Ignoring installation step

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes