angular: AoT Compiler does not work on Windows

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior On Windows, the ngc compiler does not emit .ngfactory.ts file, instead, it emits .js, .js.map and .metadata.json files. On Ubuntu, it works as expected.

Expected/desired behavior ngc should produce .ngfactory.ts file.

Please tell us about your environment: Windows 10 Professional, NodeJS v6.3.1 and v6.2.0

  • Angular version: 2.0.0-rc.5
  • Language: TypeScript@next

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 19
  • Comments: 46 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I have the same problem

I had a same problem and solved it. So I share this.

check version of your compiler-cli & compiler

  • C:\path_to_your_project\node_modules\ @angular\compiler-cli\package.json
  • C:\path_to_your_project\node_modules\ @angular\compiler\package.json it should be match each other.

if compiler-cli got different version, install again with specific version npm install @angular/compiler-cli@{your compiler version}

I think somethimes ‘@angular\compiler-cli’ installed not properly with other version. (now Im using version 2.2.2)

Likewise here.

ngc generate js files what I don’t want.

ngc 0.6.0@windows 7

.\node_modules\.bin\ngc -p tsconfig.aot.json

tsconfig.aot.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": false,
    "experimentalDecorators": true,
    "removeComments": true,
    "noImplicitAny": true
  },
  "exclude": [
    "node_modules",
    "typings"
  ],
  "angularCompilerOptions" : {
    "skipMetadataEmit": true
  }
}

example: app.module.ts

app.module.ts => app.module.js app.module.ngfactory.ts app.module.ngfactory.js

I only want app.module.ngfactory.ts, but lots of js files also generated. When run webpack at next stage, webpack(ts-loader + another tsconfig.json) will choose js file first (not ts). Because of "module": "es2015" setting in tsconfig.aot.json, webpack not recognize ES2015 import syntax in generated js files.

How could I generate ngfactory.ts file only?

@gdyrrahitis upgrade @angular/compiler-cli to 0.6.0

@AAAnderson7301, to run ngc on the command prompt, put " around the path, like this:

C:\path_to_your_project> "node_modules/.bin/ngc" -p

PS. Will take a look on RC.6 asap

The fix for this issue (#10919) has been merged into the master branch. So I think it’s gonna be fixed in RC6.

As a workaround for Windows 10 users, you can use node inside LXSS (more commonly Bash on Ubuntu on Windows) and the codegen seems to work correctly.