0

I was receiving the following error when I tried to run the following command on the CLI:

ng generate component [component-name]

I kept getting:

Cannot read property 'sourceRoot' of undefined

I am guessing I started getting it after updating the version of angular I was on. Cannot read property 'sourceRoot' of undefined

See reply for solution.

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
Roger Perez
  • 2,807
  • 29
  • 31

1 Answers1

0

To fix the issue I had to go to my Angular.json folder.

  1. Search "e2e"
  2. Update the 'root' from 'e2e/' to '/'. The location is under '[project-name]-e2e'

enter image description here

Once updated I was able to run the command

ng generate component [component-name]

No issues came up

ng generate component product-search

Roger Perez
  • 2,807
  • 29
  • 31