I run in angular 4 project with ng serve and i get error
Cannot read property \'length\' of undefined
but I don\'t have any property length in
My error was caused by c&p error when creating a small component. I forgot to change path to component's template and styles.
Close the running port and Try rebuilding the app with "ng build"
Could be bad path to component templateUrl, perhaps missing the ./
Before: templateUrl: 'my-control.component.html',
After: templateUrl: './my-control.component.html',
Most likely you have changed around your modules in a way that needs the CLI to be restarted.
I had the same error running ng serve
after removing a component from a module. By restarting that process and re running ng serve
the error went away.
In my case I did the following and it solved the issue:
Create environments folder (if not exist) in src of the Project C:\Users\abcd\Desktop\MyApp\src
Put the two files environment.ts and environment.prod.ts in environments folder.
In my case, it's mysterious. But it won't hurt to offer what I had witnessed and maybe a bit history. None or maybe some historical event might have caused it but I really don't know.
18.04.4 LTS (Bionic Beaver)LXC
within 19.10 ubuntu host
with npm 6.14.2
, node10.16.3
20.04 LTS(Focal Fossa)
. Write some code. Remove a package called angular-shepherd
. Try to build --prod. This errors shows up during angular Generating ES5 bundles.