question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IVY doesn't working on Windows even in Angular 8.0.0-beta.7

See original GitHub issue

🐞 bug report

Affected Package

Angular IVY on Windows

Description

I know there was a file path problem in Angular IVY compiler on Windows, but it seems that it has been fixed in Angular 8.0.0-beta.7 (https://github.com/angular/angular/pull/28752)

I tried compiling my project with latest version of Angular. ivy-ngcc postinstall script in package.json seem to be working fine. But it still doesn’t recognizing the modules of the app and showing below error:

ERROR in Unable to write a reference to MyDirective in D:/MyProject/src/app/shared/my-directive/my-directive.directive.ts from D:/MyProject/src/app/shared/my-directive/my-directive.module.ts

I am following the instructions mentioned in https://next.angular.io/guide/ivy

I thought I could be missing something while updating my existing project.

So I tried generating a new project using below command:

ng new temp --enableIvy

After generating the project I updated Angular to latest version Angular 8.0.0-beta.7.

When running npm install, I can see that after package installation ivy-ngcc postinstall script in package.json seem to be working fine.

But when I tried running the build command ng build --prod, it threw below error:

ERROR in Unable to write a reference to AppComponent in D:/MyProject/src/app/app.component.ts from D:/MyProject/src/app/app.module.ts

🔬 Minimal Reproduction

On windows machine generate a new project:

ng new temp --enableIvy

Update Angular to latest version i.e. Angular 8.0.0-beta.7

Run npm install

Then run ng build --prod

🔥 Exception or Error


```
ERROR in Unable to write a reference to AppComponent in D:/MyProject/src/app/app.component.ts from D:/MyProject/src/app/app.module.ts
```

🌍 Your Environment

Angular Version:




Angular CLI: 8.0.0-beta.4
Node: 8.11.4
OS: win32 x64
Angular: 8.0.0-beta.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.14.0-beta.4
@angular-devkit/build-angular     0.14.0-beta.4
@angular-devkit/build-optimizer   0.14.0-beta.4
@angular-devkit/build-webpack     0.14.0-beta.4
@angular-devkit/core              8.0.0-beta.4
@angular-devkit/schematics        8.0.0-beta.4
@angular/cli                      8.0.0-beta.4
@ngtools/webpack                  8.0.0-beta.4
@schematics/angular               8.0.0-beta.4
@schematics/update                0.14.0-beta.4
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
alexzuzacommented, Mar 7, 2019

rootDirs that come to the LogicalFileSystem have absolute paths with leading slash, i.e.

['/D/Angular/ivy-test/...'] where D is a name of driver.

due to the fact how Angular cli normalizes such paths https://github.com/angular/angular-cli/blob/fd5cb7a7f0c36e737fb3bb5e64fb2b66c2fef55d/packages/angular_devkit/core/src/virtual-fs/path.ts#L210

Because of that Windows version is broken here

https://github.com/angular/angular/blob/7060d9038b11a7c67cdce6b58464a935e9a340c5/packages/compiler-cli/src/ngtsc/path/src/logical.ts#L79-L83

physicalFile.startsWith(rootDir)

"D:/Angular/ivy-test/...".startsWith("/D/Angular/ivy/test...")

@alxhub please take a look

7reactions
alan-agius4commented, Mar 7, 2019

Hi @alexzuza, that is indeed part of the problem, however another problem is that if you don’t use the CLI the problem still persists becausegetCurrentDirectory https://github.com/angular/angular/blob/master/packages/compiler-cli/src/ngtsc/util/src/typescript.ts#L79 is assumed to be posix separated which is not when using typescript compiler directly.

Will be landing a couple of PRs to fix these implementations soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The new Angular ivy compiler finally works on Windows!
Ivy is the new template compiler for Angular. It will be released with Angular 8 as opt-in (the old compiler will still be...
Read more >
How do I enable Ivy for Angular 8 or 9? - Stack Overflow
Using Ivy in an existing project : To update an existing project to use Ivy, set the enableIvy option in the angularCompilerOptions in...
Read more >
Changelog of ngx-extended-pdf-viewer - PdfShowcase
I am still trying to understand what is going on, so there might be side-effects. However, my tests did not reveal such side-effects...
Read more >
The Angular Ivy guide for library authors - DEV Community ‍ ‍
There are two reasons for this: The Ivy Instruction Set which is the compilation output in directive and component rendering functions will not ......
Read more >
logout when browser is closed angular - You.com
But the functions @HostListener('window:beforeunload') and @HostListener('window:onunload') are not working. So, in the ngOnInit of my app.component.ts, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found