Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info

@sliceofbytes I’ve gone through a series of different errors but the I first ran into a zone.js error:

Uncaught Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.

Which I researched and found out that it’s better for angular components to use a push strategy for change detection so I removed zone.js from my component which got rid of that error.

Next error I received was:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name “app-my-button" has already been used with this registry

Which I was able to resolve with a check if (!customElements.get('element')) customElements.define('element', buttonElement);

Now that I’ve added that check, in production, my page does not load (no console errors either). Since I used angular CLI to create my elements project and combined all of my .js files into one, I’m thinking there must be some sort of conflict between my elements .js file and the .js file of the angular application that I’m using my element.js file in. I’ve been up for days trying to resolve this. I initially followed: https://blog.bitsrc.io/using-angular-elements-why-and-how-part-1-35f7fd4f0457 to create my web component (it’s more or less the same as other articles I’ve read). Locally everything runs as expected.

I should also mention that I’m using angular 8 for both my application and my web component
@thedubb have you looked over the angular.io code that uses custom elements
I would follow their example
thanks @sliceofbytes i’ve taken a look at angular.io but haven’t seen the link you posted, I’ll take a look at that.

hey there, I'm having troubles with AOT and after hours of Googling I can't find a solution. Let me be concise, I load two different components depending on a property of environments

const routes = [{
  component: environment.foo ? FooComponent : BarComponent

What's special in my project is that environment.ts file is lazy loaded, so same Docker container runs on different environments

// environment.ts
export const environment = (window as any).__env;

The issue is that when I run ng build with AoT enabled this is generated:

const routes = [{
  component: BarComponent

It's like AoT is evaluating environment.foo on build time, can I prevent that?

Is there any reason not to just straight-up precompile polyfills and host them statically rather than building them every time?
Seems a waste
Hi Guys,
The build command requires to be run in an Angular project, but a project definition could not be found.
i got this error while i was updating my angular project
Any one know why its showing this message
Any Idea?
ERROR in error TS2688: Cannot find type definition file for 'q'.
error TS2688: Cannot find type definition file for 'selenium-webdriver'.
Anyone else get the above error when running ng serve? It seems like whenever I delete node_modules and reinstall, that fixes the issue. But it always comes back after a computer reboot.
Is there any way to call angular-cli from a node script? Or is it just use child_process.spawn

@alan-agius4 Thanks a lot for angular/angular-cli#15453

Hopefully that's resolved one day. It's really ticking my nerves though :(

Luis Eduardo Jiménez Robles
Hi :wave:
i was trying to find something about i18n where I can contribute translating angular/cli docs to spanish
is that a necessary thing right no?
Lucas Granberg
I am using ng build with --watch. Sometimes I do changes that are not picked up by this. Would it be possible to add a feature where you press (for example) enter and it would force rebuild without restarting the ng build command?
João Eduardo Soares e Silva
I'm getting Unexpected value 'undefined' declared by the module when building to production using ng build --prod If I remove the --prod tag, it build normally.
the ofending module is FreBaseComponentsModule which is a module from my angular Library. It complains about in /Users/jed/Projects/Angular/angular-fre-base-components/dist/fre-base-components/fre-base-components.d.ts' but the file its only the typing exports, anyone got a clue about what could be causing this? I 've googled this but all the problems I've found were in different scenarios than mine.

How can i run sed -i.compiler.bak 's/"packages\/\*\/src"/"dist\/packages\/\*"/' tsconfig.json in GNU bash but when i do

"scripts": {
    "tsconfig:set": "sed -i.compiler.bak 's/\"packages\\/\\*\\/src\"/\"dist\\/packages\\/\\*\"/' tsconfig.json",

it throws an error 'sed' is not recognized as an internal or external command, can i execute some bash script from npm

James Tikalsky

@ZBAGI Yes, you can run bash scripts from npm. Maybe try seeing what the environment for npm is by adding another entry to scripts:

“scripts”: {
  “env”: “env”

Then run:
npm run env (or perhaps npm run env | grep PATH)

James Scharett
anyone know if there are any vscode extensions for working with schematic .template files?
Jai Chandra
Hi All,
I posted this in angular room, but I guess this belongs here:
I am getting below error since yesterday looks like some dependency update issue. Any help is appreciated.
ERROR: Unknown version 67 of android
An unhandled exception occurred: Unknown version 67 of android
See "/private/var/folders/3d/xqlw65w14z58l73ppm17kxth0000gp/T/ng-kDIunG/angular-errors.log" for further details.
@jaichandra did you ever find a fix for your issue? I am experiencing the same after migrating from Angular 7 to 8
@jaichandra I fixed it for me by removing my node_modules directory and reinstalling everything via npm install. Seems I had an incompatible version of autoprefixer somewhere
Richa Vyas
Hi, I am implementing ng update schematics for my library. I am wondering how it can be tested locally!!
Rémy Binsztock

Hi, I am currently working on a monorepository project with 6 libs inside /projects and one main application inside /src folder. When we want to develop something we need to start the library with ng build library-name --watch and in another terminal ng serve so when a change is made inside the library, the library will refresh and the main app will also refresh but we always need to save 3 or 4 times before the change are propagated to the main application. It's like the app refresh before the library and even after 2 refresh, it need more save to force another one refresh to see change in app.

Does anyone have an idea how to fix this problem ? Thank you ( We also disabled AOT has it slowdown the compile)

Rémy Binsztock
adding --poll=2000 flag into ng serve "fixed" the reload change
I have uninstalled angular 7.x and node. Rebooted my Windows 7 box and re-installed latest stable of node and confirmed node and npm are installed (with the '-v' switch). Followed the normal steps to install angular (as per https://angular.io/guide/setup-local) and no errors, but when i do >ng new my-app in my Bash shell, it says: "Error: Cannot find module 'C:\Program Files\Git\node_modules\@angular\cli\bin\ng'"
Looking at my folder structure, there is no ''C:\Program Files\Git\node_modules" folder !?!
@bradws you likely have a bad path variable for ng
try which ng in your cmd prompt
which ng
shows "/c/Users/Brad/AppData/Roaming/npm/ng"
that looks correct, try ng new testapp in your cmd prompt
ng new testapp
shows error:

throw err;

Error: Cannot find module 'C:\Program Files\Git\node_modules\@angular\cli\bin\ng'

Are the 2 script files at C:\Users\Brad\AppData\Roaming\npm\ng and C:\Users\Brad\AppData\Roaming\npm\ng .cmd possibly wrong?
try npm install -g @angular-devkit/core
and then retry creating the app
$ npm install -g @angular-devkit/core
  • @angular-devkit/core@8.3.6
    added 12 packages from 49 contributors in 7.958s
    (seems ok)