Base solution for your next web application
Open Closed

Getting Error In fresh downloaded Angular project (code) #7262


User avatar
1
PMS created

Hello Support Team,

Find the Angular code from here : removed for security concerns by alper

After Download code I performed below step to configure the angular app.

  1. Open In the visual code
  2. In Terminal Run the command -- > yarn to install the Node_modules
  3. After successfully install the Node_modules then run this command npm start
  4. When run the localhost url in browser http://localhost:4200/ getting errors in browser console like
Unhandled Promise rejection: Cannot read property 'toLowerCase' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'toLowerCase' of undefined
    at setLocaleId (core.js:23653)
    at core.js:27262
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:26763)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
    at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.run (core.js:26677)
    at PlatformRef.push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (core.js:27253)
    at core.js:27296
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391) TypeError: Cannot read property 'toLowerCase' of undefined
    at setLocaleId (http://localhost:4200/vendor.js:70988:26)
    at http://localhost:4200/vendor.js:74597:13
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4200/polyfills.js:12618:26)
    at Object.onInvoke (http://localhost:4200/vendor.js:74098:33)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4200/polyfills.js:12617:52)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:4200/polyfills.js:12377:43)
    at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.run (http://localhost:4200/vendor.js:74012:28)
    at PlatformRef.push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (http://localhost:4200/vendor.js:74588:23)
    at http://localhost:4200/vendor.js:74631:59
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4200/polyfills.js:12618:26)
Error screenshot Please review & help to resolve this error ASAP.


33 Answer(s)
  • User Avatar
    0
    ravindrapatail created

    Tried all above solutions but getting same error

  • User Avatar
    0
    maliming created
    Support Team

    hi @ravindrapatail

    Can you check the version of the angular related package in your yarn.lock file?

    Make sure they @^8.0.0

    https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/yarn.lock#L114

  • User Avatar
    0
    enio created

    My understanding of the ^8.0.0 pattern is that npm/yarn will install the latest version with 8.x.x. Therefore in my scenario the problem suddenly occured when angular has published version 8.1. So my build automatically switched to 8.1. My solution was simple - I have just changed all angular related entries in package.json from ^8.0.0 to ~8.0.0. In my opinion this pattern represents 8.0.x - therefore the angular version was nailed down to 8.0 and not switching to the problematic 8.1 version.

  • User Avatar
    0
    joe704la created

    I am having the same issue. I have confirmed both my yarn.lock shows using angular 8.0.0 same with the package.json versions. Any updates on this?

  • User Avatar
    0
    maliming created
    Support Team

    @joe704la Can you share your angular project code to [email protected]?

  • User Avatar
    0
    TomLeonard created

    expiriencing the same issue after 7.1 upgrade (yarn + core + angular)

  • User Avatar
    0
    joe704la created

    I followed enio suggestion of switching all angular packages from ^8.0.0 to ~8.0.0. This works as a temporary solution. But it for sure seems to be an issue with angular 8.1.

  • User Avatar
    0
    maliming created
    Support Team

    hi all

    Please use angular less than or equal to v8.0.0. Please follow this Github issue: https://github.com/aspnetzero/aspnet-zero-core/issues/2476

    Angular has fixed the above problem, but has not released a new version, let us wait