New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using invalid environment causes error in build (was "ERROR in Cannot read property 'length' of undefined") #5053

Closed
istiti opened this Issue Feb 27, 2017 · 167 comments

Comments

Projects
None yet
@istiti

istiti commented Feb 27, 2017

(on existing project, on windows10) After updating :

  1. cli 31 to rc0
  2. angular packages to rc1
  3. typescript to 2.1.6

I get this insignifiant message error when runningng serve orng build:

Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined

What does this mean ?

@deebloo

This comment has been minimized.

Show comment
Hide comment
@deebloo

deebloo Feb 27, 2017

Contributor

@istiti can you fill out the issue template and give the steps to reproduce? What version of the cli are you updating from?

Contributor

deebloo commented Feb 27, 2017

@istiti can you fill out the issue template and give the steps to reproduce? What version of the cli are you updating from?

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 27, 2017

@deebloo please apologize see point 1 again.
I have no additional info:


Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14552:109)
    at parseSourceFileWorker (C:\Users\.....\node_modules\typescript\lib\typescript.js:14484:26)
    at Object.parseSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14433:26)
    at Object.createSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14288:29)
    at WebpackCompilerHost.getSourceFile (C:\Users\.....\node_modules\@ngtools\webpack\src\compiler_host.js:210:27)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63453:29)
    at processSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63384:27)
    at C:\Users\.....\node_modules\typescript\lib\typescript.js:63494:17
    at Object.forEach (C:\Users\.....\node_modules\typescript\lib\typescript.js:1293:30)
    at processReferencedFiles (C:\Users\.....\node_modules\typescript\lib\typescript.js:63492:16)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63477:21)
    at processImportedModules (C:\Users\.....\node_modules\typescript\lib\typescript.js:63600:25)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63481:17)
    at processSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63384:27)
    at processRootFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63271:13)
    at C:\Users\.....\node_modules\typescript\lib\typescript.js:62620:60
    at Object.forEach (C:\Users\.....\node_modules\typescript\lib\typescript.js:1293:30)
    at Object.createProgram (C:\Users\.....\node_modules\typescript\lib\typescript.js:62620:16)
    at AotPlugin._setupOptions (C:\Users\.....\node_modules\@ngtools\webpack\src\plugin.js:124:28)
    at new AotPlugin (C:\Users\.....\node_modules\@ngtools\webpack\src\plugin.js:23:14)
    at _createAotPlugin (C:\Users\.....\node_modules\@angular\cli\models\webpack-configs\typescript.js:55:12)
    at Object.exports.getNonAotConfig (C:\Users\.....\node_modules\@angular\cli\models\webpack-configs\typescript.js:70:19)
    at NgCliWebpackConfig.buildConfig (C:\Users\.....\node_modules\@angular\cli\models\webpack-config.js:27:37)
    at Class.run (C:\Users\.....\node_modules\@angular\cli\tasks\serve.js:37:98)
    at check_port_1.checkPort.then.port (C:\Users\.....\node_modules\@angular\cli\commands\serve.js:103:26)
    at process._tickCallback (internal/process/next_tick.js:103:7)

istiti commented Feb 27, 2017

@deebloo please apologize see point 1 again.
I have no additional info:


Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14552:109)
    at parseSourceFileWorker (C:\Users\.....\node_modules\typescript\lib\typescript.js:14484:26)
    at Object.parseSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14433:26)
    at Object.createSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:14288:29)
    at WebpackCompilerHost.getSourceFile (C:\Users\.....\node_modules\@ngtools\webpack\src\compiler_host.js:210:27)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63453:29)
    at processSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63384:27)
    at C:\Users\.....\node_modules\typescript\lib\typescript.js:63494:17
    at Object.forEach (C:\Users\.....\node_modules\typescript\lib\typescript.js:1293:30)
    at processReferencedFiles (C:\Users\.....\node_modules\typescript\lib\typescript.js:63492:16)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63477:21)
    at processImportedModules (C:\Users\.....\node_modules\typescript\lib\typescript.js:63600:25)
    at findSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63481:17)
    at processSourceFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63384:27)
    at processRootFile (C:\Users\.....\node_modules\typescript\lib\typescript.js:63271:13)
    at C:\Users\.....\node_modules\typescript\lib\typescript.js:62620:60
    at Object.forEach (C:\Users\.....\node_modules\typescript\lib\typescript.js:1293:30)
    at Object.createProgram (C:\Users\.....\node_modules\typescript\lib\typescript.js:62620:16)
    at AotPlugin._setupOptions (C:\Users\.....\node_modules\@ngtools\webpack\src\plugin.js:124:28)
    at new AotPlugin (C:\Users\.....\node_modules\@ngtools\webpack\src\plugin.js:23:14)
    at _createAotPlugin (C:\Users\.....\node_modules\@angular\cli\models\webpack-configs\typescript.js:55:12)
    at Object.exports.getNonAotConfig (C:\Users\.....\node_modules\@angular\cli\models\webpack-configs\typescript.js:70:19)
    at NgCliWebpackConfig.buildConfig (C:\Users\.....\node_modules\@angular\cli\models\webpack-config.js:27:37)
    at Class.run (C:\Users\.....\node_modules\@angular\cli\tasks\serve.js:37:98)
    at check_port_1.checkPort.then.port (C:\Users\.....\node_modules\@angular\cli\commands\serve.js:103:26)
    at process._tickCallback (internal/process/next_tick.js:103:7)

@metamaker

This comment has been minimized.

Show comment
Hide comment
@metamaker

metamaker Feb 27, 2017

@istiti Did you use ng new to create the project?

If so, make sure that you kept all original arrays in .angular-cli.json configuration like assets, styles and scripts. I received mistake as you do, because I removed assets option from .angular-cli.json.

metamaker commented Feb 27, 2017

@istiti Did you use ng new to create the project?

If so, make sure that you kept all original arrays in .angular-cli.json configuration like assets, styles and scripts. I received mistake as you do, because I removed assets option from .angular-cli.json.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 27, 2017

@metamaker no I don't use ng new I have assets styles and scripts as array.
I try on exisiting project running angular 2.4.8 ith cli31 to update to cli-rc0 and angular rc1 !

istiti commented Feb 27, 2017

@metamaker no I don't use ng new I have assets styles and scripts as array.
I try on exisiting project running angular 2.4.8 ith cli31 to update to cli-rc0 and angular rc1 !

@metamaker

This comment has been minimized.

Show comment
Hide comment
@metamaker

metamaker Feb 27, 2017

Provide your .angular-cli.json, please.

Provide your .angular-cli.json, please.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 27, 2017

https://gist.github.com/istiti/e544744f16480829416e62b32167051e

ps: when running ng new test --ng4 it works... but I want get working again my existing project

istiti commented Feb 27, 2017

https://gist.github.com/istiti/e544744f16480829416e62b32167051e

ps: when running ng new test --ng4 it works... but I want get working again my existing project

@metamaker

This comment has been minimized.

Show comment
Hide comment
@metamaker

metamaker Feb 27, 2017

Your .angular-cli.json looks ok, not sure what is wrong. Maybe someone else will be able to help you ;) .

metamaker commented Feb 27, 2017

Your .angular-cli.json looks ok, not sure what is wrong. Maybe someone else will be able to help you ;) .

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 27, 2017

additional info :
I tried in green project "ng new mynewproject --ng4" it work well, it run!

then move all my old /app folder to this new one and I get same error !

apparently the issue is in my code/module ... My project is relativly big I can't remove module by module :(

how achieve this ? can I get more signifiant message error

thanks

istiti commented Feb 27, 2017

additional info :
I tried in green project "ng new mynewproject --ng4" it work well, it run!

then move all my old /app folder to this new one and I get same error !

apparently the issue is in my code/module ... My project is relativly big I can't remove module by module :(

how achieve this ? can I get more signifiant message error

thanks

@hansl

This comment has been minimized.

Show comment
Hide comment
@hansl

hansl Feb 27, 2017

Collaborator

This is a real issue and we will look at it.

Collaborator

hansl commented Feb 27, 2017

This is a real issue and we will look at it.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 27, 2017

Additionals infos:
Yes of course I always use Renderer and template in my project.. but need more signifiant message error to achieve this properlly.

Thanks, actually can't move...

Cc @hansl

istiti commented Feb 27, 2017

Additionals infos:
Yes of course I always use Renderer and template in my project.. but need more signifiant message error to achieve this properlly.

Thanks, actually can't move...

Cc @hansl

@hansl

This comment has been minimized.

Show comment
Hide comment
@hansl

hansl Feb 28, 2017

Collaborator

@isiti can you provide a repository or some sort of code sample that we could use to reproduce? Maybe your package.json might be enough, if you're okay to share that.

Collaborator

hansl commented Feb 28, 2017

@isiti can you provide a repository or some sort of code sample that we could use to reproduce? Maybe your package.json might be enough, if you're okay to share that.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Feb 28, 2017

Will do it tomorrow at 7AM (UTC +1)

Thanks coz can't move (actually blocked)

@hansl

istiti commented Feb 28, 2017

Will do it tomorrow at 7AM (UTC +1)

Thanks coz can't move (actually blocked)

@hansl

@trentmswanson

This comment has been minimized.

Show comment
Hide comment
@trentmswanson

trentmswanson Feb 28, 2017

I was experiencing the same issue here and after I rolled typescript back from 2.2.1 to 2.0.10 that seemed to fix it.

I was experiencing the same issue here and after I rolled typescript back from 2.2.1 to 2.0.10 that seemed to fix it.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 1, 2017

@hansl here you are https://gist.github.com/istiti/f97eb83c6d18fd1d23965e4a3325033e

@trentmswanson FYI after passing from 2.1.6 to 2.0.10 I get this error

then when I update typescript from 2.0.10 to 2.2.1 I get same error as in 2.1.6

istiti commented Mar 1, 2017

@hansl here you are https://gist.github.com/istiti/f97eb83c6d18fd1d23965e4a3325033e

@trentmswanson FYI after passing from 2.1.6 to 2.0.10 I get this error

then when I update typescript from 2.0.10 to 2.2.1 I get same error as in 2.1.6

@rdesimone

This comment has been minimized.

Show comment
Hide comment
@rdesimone

rdesimone Mar 1, 2017

The strange thing here: the project with angular-cli rc.0 was working fine till executing the first ng build --target=production (maybe just a coincidence). Since then the project is broken. ng serve gives the same error now.

When I setup a new project, it is possible to build.

I removed and reinstalled angular-cli like documented (including node_modules) - the same. Also downgraded Typescript to 2.0.0 like the default for a blank project and took all possible settings of a blank project.

rdesimone commented Mar 1, 2017

The strange thing here: the project with angular-cli rc.0 was working fine till executing the first ng build --target=production (maybe just a coincidence). Since then the project is broken. ng serve gives the same error now.

When I setup a new project, it is possible to build.

I removed and reinstalled angular-cli like documented (including node_modules) - the same. Also downgraded Typescript to 2.0.0 like the default for a blank project and took all possible settings of a blank project.

@filipesilva filipesilva changed the title from undefined to ERROR in Cannot read property 'length' of undefined Mar 1, 2017

@rdesimone

This comment has been minimized.

Show comment
Hide comment
@rdesimone

rdesimone Mar 1, 2017

Checking out from the repository into a new directory and running npm install fixed the issue - the files are the same. The project in the original directory became suddenly unusable - was not able to find out the reason.

Checking out from the repository into a new directory and running npm install fixed the issue - the files are the same. The project in the original directory became suddenly unusable - was not able to find out the reason.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 1, 2017

As said : I putt in new green cli --ng4 project whole my /app folder and same issue

istiti commented Mar 1, 2017

As said : I putt in new green cli --ng4 project whole my /app folder and same issue

@moniuch

This comment has been minimized.

Show comment
Hide comment
@moniuch

moniuch Mar 1, 2017

Apart from the lack of a descriptive message (which is the main focus for this issue), should anyone run into this case, don't panic - chances are that it's just a temporary glitch. I ran into this situation twice and it looked like a local problem with syncing files. The second incident of mine was a bit more clear to me - it followed a git pull. Waiting ca 1 minute and rebooting ng serve cured the app and restored its running state.

FWIW: Since this is ng serve reboot that helps, I would recommend to look closer at the angular-cli.json file - perhaps into the apps.assets item which has been made a mandatory array if I am correct (meaning it does not accept a single string anymore).

moniuch commented Mar 1, 2017

Apart from the lack of a descriptive message (which is the main focus for this issue), should anyone run into this case, don't panic - chances are that it's just a temporary glitch. I ran into this situation twice and it looked like a local problem with syncing files. The second incident of mine was a bit more clear to me - it followed a git pull. Waiting ca 1 minute and rebooting ng serve cured the app and restored its running state.

FWIW: Since this is ng serve reboot that helps, I would recommend to look closer at the angular-cli.json file - perhaps into the apps.assets item which has been made a mandatory array if I am correct (meaning it does not accept a single string anymore).

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 2, 2017

additional info: same behavior with angular rc2

istiti commented Mar 2, 2017

additional info: same behavior with angular rc2

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 2, 2017

additional info

with this conf. my project works/compile fine with typescript 2.1.6 here's my working package.json:

@angular/cli: 1.0.0-rc.0
node: 6.9.2
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.9

BUT it breaks

when I add these lines to my package.json, I getlength undefined:

"@angular/common": ">=4.0.0-beta <5.0.0",
"@angular/compiler": ">=4.0.0-beta <5.0.0",
"@angular/core": ">=4.0.0-beta <5.0.0",
"@angular/forms": ">=4.0.0-beta <5.0.0",
"@angular/http": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
"@angular/router": ">=4.0.0-beta <5.0.0"

istiti commented Mar 2, 2017

additional info

with this conf. my project works/compile fine with typescript 2.1.6 here's my working package.json:

@angular/cli: 1.0.0-rc.0
node: 6.9.2
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.9

BUT it breaks

when I add these lines to my package.json, I getlength undefined:

"@angular/common": ">=4.0.0-beta <5.0.0",
"@angular/compiler": ">=4.0.0-beta <5.0.0",
"@angular/core": ">=4.0.0-beta <5.0.0",
"@angular/forms": ">=4.0.0-beta <5.0.0",
"@angular/http": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
"@angular/router": ">=4.0.0-beta <5.0.0"
@cgebe

This comment has been minimized.

Show comment
Hide comment
@cgebe

cgebe Mar 2, 2017

same issue for me.

I get this error only when building/serving with --prod flag:

    "@angular/cli": "1.0.0-rc.0",
    "@angular/common": "^2.4.8",
    "@angular/compiler": "^2.4.8",
    "@angular/compiler-cli": "^2.4.8",
    "@angular/core": "^2.4.8",
    "@angular/forms": "^2.4.8",
    "@angular/http": "^2.4.8",
    "@angular/platform-browser": "^2.4.8",
    "@angular/platform-browser-dynamic": "^2.4.8",
    "@angular/router": "^3.4.8",
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14546:109)
    at parseSourceFileWorker (/home/...../node_modules/typescript/lib/typescript.js:14478:26)
    at Object.parseSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14427:26)
    at Object.createSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14282:29)
    at VirtualFileStats.getSourceFile (/home/...../node_modules/@ngtools/webpack/src/compiler_host.js:66:35)
    at WebpackCompilerHost.getSourceFile (/home/.....node_modules/@ngtools/webpack/src/compiler_host.js:213:38)
    at findSourceFile (/home/...../node_modules/typescript/lib/typescript.js:63447:29)
    at processImportedModules (/home/...../node_modules/typescript/lib/typescript.js:63594:25)
    at findSourceFile (/home/...../node_modules/typescript/lib/typescript.js:63475:17)
    at processSourceFile (/home/.....node_modules/typescript/lib/typescript.js:63378:27)
    at processRootFile (/home/...../node_modules/typescript/lib/typescript.js:63265:13)
    at /home/...../node_modules/typescript/lib/typescript.js:62614:60
    at Object.forEach (/home/...../node_modules/typescript/lib/typescript.js:1293:30)
    at Object.createProgram (/home/...../node_modules/typescript/lib/typescript.js:62614:16)
    at AotPlugin._setupOptions (/home/...../node_modules/@ngtools/webpack/src/plugin.js:124:28)
    at new AotPlugin (/home/...../node_modules/@ngtools/webpack/src/plugin.js:23:14)
    at _createAotPlugin (/home/...../node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
    at Object.exports.getAotConfig (/home/...../node_modules/@angular/cli/models/webpack-configs/typescript.js:89:19)
    at NgCliWebpackConfig.buildConfig (/home/...../node_modules/@angular/cli/models/webpack-config.js:26:37)
    at Class.run (/home/...../node_modules/@angular/cli/tasks/build.js:27:92)
    at Class.run (/home/...../node_modules/@angular/cli/commands/build.js:143:26)
    at Class.<anonymous> (/home/...../node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)

cgebe commented Mar 2, 2017

same issue for me.

I get this error only when building/serving with --prod flag:

    "@angular/cli": "1.0.0-rc.0",
    "@angular/common": "^2.4.8",
    "@angular/compiler": "^2.4.8",
    "@angular/compiler-cli": "^2.4.8",
    "@angular/core": "^2.4.8",
    "@angular/forms": "^2.4.8",
    "@angular/http": "^2.4.8",
    "@angular/platform-browser": "^2.4.8",
    "@angular/platform-browser-dynamic": "^2.4.8",
    "@angular/router": "^3.4.8",
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14546:109)
    at parseSourceFileWorker (/home/...../node_modules/typescript/lib/typescript.js:14478:26)
    at Object.parseSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14427:26)
    at Object.createSourceFile (/home/...../node_modules/typescript/lib/typescript.js:14282:29)
    at VirtualFileStats.getSourceFile (/home/...../node_modules/@ngtools/webpack/src/compiler_host.js:66:35)
    at WebpackCompilerHost.getSourceFile (/home/.....node_modules/@ngtools/webpack/src/compiler_host.js:213:38)
    at findSourceFile (/home/...../node_modules/typescript/lib/typescript.js:63447:29)
    at processImportedModules (/home/...../node_modules/typescript/lib/typescript.js:63594:25)
    at findSourceFile (/home/...../node_modules/typescript/lib/typescript.js:63475:17)
    at processSourceFile (/home/.....node_modules/typescript/lib/typescript.js:63378:27)
    at processRootFile (/home/...../node_modules/typescript/lib/typescript.js:63265:13)
    at /home/...../node_modules/typescript/lib/typescript.js:62614:60
    at Object.forEach (/home/...../node_modules/typescript/lib/typescript.js:1293:30)
    at Object.createProgram (/home/...../node_modules/typescript/lib/typescript.js:62614:16)
    at AotPlugin._setupOptions (/home/...../node_modules/@ngtools/webpack/src/plugin.js:124:28)
    at new AotPlugin (/home/...../node_modules/@ngtools/webpack/src/plugin.js:23:14)
    at _createAotPlugin (/home/...../node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
    at Object.exports.getAotConfig (/home/...../node_modules/@angular/cli/models/webpack-configs/typescript.js:89:19)
    at NgCliWebpackConfig.buildConfig (/home/...../node_modules/@angular/cli/models/webpack-config.js:26:37)
    at Class.run (/home/...../node_modules/@angular/cli/tasks/build.js:27:92)
    at Class.run (/home/...../node_modules/@angular/cli/commands/build.js:143:26)
    at Class.<anonymous> (/home/...../node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)
@henritoivar

This comment has been minimized.

Show comment
Hide comment
@henritoivar

henritoivar Mar 2, 2017

I have the same issue on ubuntu 14.04 with node 7.6.0, npm 4.1.2 when running: ng build. works on my windows machine. here is my package.json.

"dependencies": {
    "@angular/common": "^2.4.8",
    "@angular/compiler": "^2.4.8",
    "@angular/core": "^2.4.8",
    "@angular/forms": "^2.4.8",
    "@angular/http": "^2.4.8",
    "@angular/platform-browser": "^2.4.8",
    "@angular/platform-browser-dynamic": "^2.4.8",
    "@angular/router": "^3.4.8",
    "@ngx-translate/core": "^6.0.0",
    "@ngx-translate/http-loader": "0.0.3",
    "bootstrap-sass": "^3.3.6",
    "core-js": "^2.4.1",
    "intl": "^1.2.4",
    "jquery-ui": "^1.12.0",
    "moment": "^2.13.0",
    "ng2-bootstrap": "^1.1.2",
    "ng2-file-upload": "^1.1.0",
    "ng2-toastr": "^1.5.1",
    "ng2-ui-auth": "^6.1.3",
    "node-sass": "^3.7.0",
    "primeng": "^2.0.1",
    "primeui": "^4.1.15",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.0",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }

I have the same issue on ubuntu 14.04 with node 7.6.0, npm 4.1.2 when running: ng build. works on my windows machine. here is my package.json.

"dependencies": {
    "@angular/common": "^2.4.8",
    "@angular/compiler": "^2.4.8",
    "@angular/core": "^2.4.8",
    "@angular/forms": "^2.4.8",
    "@angular/http": "^2.4.8",
    "@angular/platform-browser": "^2.4.8",
    "@angular/platform-browser-dynamic": "^2.4.8",
    "@angular/router": "^3.4.8",
    "@ngx-translate/core": "^6.0.0",
    "@ngx-translate/http-loader": "0.0.3",
    "bootstrap-sass": "^3.3.6",
    "core-js": "^2.4.1",
    "intl": "^1.2.4",
    "jquery-ui": "^1.12.0",
    "moment": "^2.13.0",
    "ng2-bootstrap": "^1.1.2",
    "ng2-file-upload": "^1.1.0",
    "ng2-toastr": "^1.5.1",
    "ng2-ui-auth": "^6.1.3",
    "node-sass": "^3.7.0",
    "primeng": "^2.0.1",
    "primeui": "^4.1.15",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.0",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
@moosetraveller

This comment has been minimized.

Show comment
Hide comment
@moosetraveller

moosetraveller Mar 3, 2017

Probably not the same cause but we had the same error (Cannot read property 'length' of undefined) when we accidentally deleted environment.prod.ts during a refactoring process. Restoring this file solved our problem.

moosetraveller commented Mar 3, 2017

Probably not the same cause but we had the same error (Cannot read property 'length' of undefined) when we accidentally deleted environment.prod.ts during a refactoring process. Restoring this file solved our problem.

@henritoivar

This comment has been minimized.

Show comment
Hide comment
@henritoivar

henritoivar Mar 3, 2017

@moosetraveller Thanks a lot. This actually happened to be the issue. On our staging server we had no environment file set up.

@moosetraveller Thanks a lot. This actually happened to be the issue. On our staging server we had no environment file set up.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 3, 2017

nop, it's not same cause... I have this file under src/environments/environments.prod.ts

cc @moosetraveller

istiti commented Mar 3, 2017

nop, it's not same cause... I have this file under src/environments/environments.prod.ts

cc @moosetraveller

@cgebe

This comment has been minimized.

Show comment
Hide comment
@cgebe

cgebe Mar 3, 2017

Issue was resolved by adding an environment.prod.ts file as stated by @moosetraveller. Thanks!
Though, an error message more appropriate to the cause would be much appreciated.

cgebe commented Mar 3, 2017

Issue was resolved by adding an environment.prod.ts file as stated by @moosetraveller. Thanks!
Though, an error message more appropriate to the cause would be much appreciated.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 3, 2017

donno why to me it isn't resolved :S and I have this file inside my project :s

istiti commented Mar 3, 2017

donno why to me it isn't resolved :S and I have this file inside my project :s

@cgebe

This comment has been minimized.

Show comment
Hide comment
@cgebe

cgebe Mar 3, 2017

@istiti

content of my environment.prod.ts:

export const environment = {
  production: true,
  silent: false
};

Maybe, there are additional causes for this issue. CLI error message is misleading in this case.

cgebe commented Mar 3, 2017

@istiti

content of my environment.prod.ts:

export const environment = {
  production: true,
  silent: false
};

Maybe, there are additional causes for this issue. CLI error message is misleading in this case.

@ctaepper

This comment has been minimized.

Show comment
Hide comment
@ctaepper

ctaepper Mar 3, 2017

i had the same problem, other cause:
one of my dependencies referenced a .d.ts file which was simply not there (https://github.com/swimlane/ngx-charts/blob/master/release/d3.js#L1) if i run ng build without aot and prod flag, it would try to lookup that file which resultet in that error

anyway, now i am not sure, if i am doing it wrong, or if @swimlane has an error here...

ctaepper commented Mar 3, 2017

i had the same problem, other cause:
one of my dependencies referenced a .d.ts file which was simply not there (https://github.com/swimlane/ngx-charts/blob/master/release/d3.js#L1) if i run ng build without aot and prod flag, it would try to lookup that file which resultet in that error

anyway, now i am not sure, if i am doing it wrong, or if @swimlane has an error here...

@moosetraveller

This comment has been minimized.

Show comment
Hide comment
@moosetraveller

moosetraveller Mar 3, 2017

@istiti there is a Stackoverflow (http://stackoverflow.com/a/41231897/42659) answer pointing out that the source folder may not be found/readable

@istiti there is a Stackoverflow (http://stackoverflow.com/a/41231897/42659) answer pointing out that the source folder may not be found/readable

@calebkiage

This comment has been minimized.

Show comment
Hide comment
@calebkiage

calebkiage Mar 3, 2017

I think in many cases this issue is caused when typescript tries to process a file that doesn't exist. In one of my projects it was a missing .d.ts file. In another it was a missing environment ts file. Adding a console.log(fileName) in the beginning of the createSourceFile function at node_modules/typescript/lib/typescript.js helped me pinpoint the specific file. Remember to remove the changes or just reinstall your node_modules.

I think in many cases this issue is caused when typescript tries to process a file that doesn't exist. In one of my projects it was a missing .d.ts file. In another it was a missing environment ts file. Adding a console.log(fileName) in the beginning of the createSourceFile function at node_modules/typescript/lib/typescript.js helped me pinpoint the specific file. Remember to remove the changes or just reinstall your node_modules.

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 3, 2017

guys thanks to solve this bug to me ! i effectivly had this /// reference to .d.ts file not exist anymore in angular4 !

one of my team member import this file accidently, he don't remember why he did this, this file was available before in ng 2.x (i think)
<reference path="../../../../../node_modules/@angular/core/src/facade/async.d.ts"/>

in another file he imported isPresent from "@angular/core/src/facade/lang" but this isPresent is now in this path "@angular/core/typings/src/facade/lang";

ps: i still not understand what is this isPresent but good no more this insignifiant error1

I let this issue open until a team memeber improve message error terminal
cc @ctaepper @calebkiage , @hansl

istiti commented Mar 3, 2017

guys thanks to solve this bug to me ! i effectivly had this /// reference to .d.ts file not exist anymore in angular4 !

one of my team member import this file accidently, he don't remember why he did this, this file was available before in ng 2.x (i think)
<reference path="../../../../../node_modules/@angular/core/src/facade/async.d.ts"/>

in another file he imported isPresent from "@angular/core/src/facade/lang" but this isPresent is now in this path "@angular/core/typings/src/facade/lang";

ps: i still not understand what is this isPresent but good no more this insignifiant error1

I let this issue open until a team memeber improve message error terminal
cc @ctaepper @calebkiage , @hansl

@calebkiage

This comment has been minimized.

Show comment
Hide comment
@calebkiage

calebkiage Mar 4, 2017

Happy to help. :-)

Happy to help. :-)

@ChrisTarasovs

This comment has been minimized.

Show comment
Hide comment
@ChrisTarasovs

ChrisTarasovs Mar 6, 2017

Hi, has anyone solved this?
I am still getting the same error:

Chriss-iMac:dnd-test christarasovs$ ng serve
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8980:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8940:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8899:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8727:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45859:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45899:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45884:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45694:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/serve.js:37:98)
at check_port_1.checkPort.then.port (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$ ng build
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8980:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8940:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8899:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8727:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45859:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45899:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45884:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45694:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/build.js:26:92)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/build.js:143:26)
at Class. (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$ ng serve
/Users/christarasovs/Desktop/dnd-test/src/app/app.component.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/core.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/di.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/opaque_token.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/type.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/directives.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/constants.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/forward_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/injector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_injector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/provider.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_provider.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_key.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util/decorators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/view.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/lifecycle_hooks.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detection_util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/lang.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/ng_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/error_handler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_init.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/console.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/compiler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/errors.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/component_factory.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detector_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/pipe_transform.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/element_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/render/api.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_keyframe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_styles.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/animation_view_context.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_queue.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/zone/ng_zone.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subject.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Operator.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subscriber.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Observer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subscription.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Observable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/observable/IfObservable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/observable/ErrorObservable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Scheduler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/scheduler/Action.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/debug_context.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_container.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_container_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/template_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_type.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_utils.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/security.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/ng_module_factory.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/component_factory_resolver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/testability/testability.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/zone.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/render.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/ng_module_factory_loader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/query_list.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/debug/debug_node.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/collection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/platform_core_providers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/i18n/tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/profile/profile.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/profile/wtf_impl.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/core_private_export.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_constants.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_group_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_sequence_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_style_util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_transition.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_transition_event.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/debug/debug_renderer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/platform_reflection_capabilities.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/types.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflector_reader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflection_capabilities.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util/lang.d.ts
/Users/christarasovs/Desktop/dnd-test/src/app/app.module.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/platform-browser.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/private_import_core.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/title.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/tools/tools.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/debug/by.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/facade/collection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/debug/ng_probe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/event_manager.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/hammer_gestures.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/security/dom_sanitization_service.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/private_export.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/generic_browser_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/location/browser_platform_location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/common.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/platform_location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/hash_location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/path_location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/localization.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/common_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_class.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_for.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_if.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_plural.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_switch.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_style.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_template_outlet.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/async_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/date_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/i18n_plural_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/i18n_select_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/json_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/lowercase_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/number_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/slice_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/uppercase_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/testability.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/dom_events.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/key_events.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/web_animations_driver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/web_animations_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_animate_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/forms.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/abstract_control_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/model.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/validators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/abstract_form_group_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/control_container.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/form_interface.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_control.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/checkbox_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/default_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_control_status.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_form.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_model.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_model_group.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/radio_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_control_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_control_name.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_group_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_group_name.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/select_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/select_multiple_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/form_builder.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/validators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/form_providers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/browser_xhr.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/jsonp_backend.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/base_response_options.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/headers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/interfaces.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/enums.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/static_request.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/body.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/url_search_params.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/static_response.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/browser_jsonp.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/xhr_backend.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/base_request_options.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/http.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/http_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/src/app/dnd/dnd.component.ts
/Users/christarasovs/Desktop/dnd-test/src/app/dnd/text/text.component.ts
/Users/christarasovs/Desktop/dnd-test/src/app/ng2-dnd/config/testing-utils.ts
/Users/christarasovs/Desktop/dnd-test/src/app/ng2-dnd/node_modules/@types/jasmine/index.d.ts
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8982:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8942:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8901:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8729:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45861:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45792:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45903:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1116:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45886:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45792:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45696:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45153:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1116:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45153:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/serve.js:37:98)
at check_port_1.checkPort.then.port (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$

Hi, has anyone solved this?
I am still getting the same error:

Chriss-iMac:dnd-test christarasovs$ ng serve
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8980:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8940:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8899:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8727:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45859:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45899:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45884:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45694:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/serve.js:37:98)
at check_port_1.checkPort.then.port (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$ ng build
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8980:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8940:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8899:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8727:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45859:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45899:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45884:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45790:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45694:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1115:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45151:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/build.js:26:92)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/build.js:143:26)
at Class. (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$ ng serve
/Users/christarasovs/Desktop/dnd-test/src/app/app.component.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/core.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/di.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/opaque_token.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/type.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/directives.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/constants.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/metadata.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/forward_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/injector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_injector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/provider.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_provider.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/di/reflective_key.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util/decorators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/view.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/lifecycle_hooks.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detection_util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/lang.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/metadata/ng_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/error_handler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_init.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/console.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/compiler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/errors.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/component_factory.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/change_detector_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection/pipe_transform.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/element_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/render/api.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_keyframe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_styles.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/animation_view_context.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_queue.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/zone/ng_zone.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subject.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Operator.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subscriber.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Observer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Subscription.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Observable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/observable/IfObservable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/observable/ErrorObservable.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/Scheduler.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/rxjs/scheduler/Action.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/debug_context.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_container.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_container_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/template_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_ref.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_type.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/view_utils.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/security.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/ng_module_factory.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/component_factory_resolver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/testability/testability.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/zone.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/render.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/ng_module_factory_loader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/query_list.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/debug/debug_node.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/facade/collection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/change_detection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/platform_core_providers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/i18n/tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/application_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/profile/profile.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/profile/wtf_impl.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/core_private_export.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_constants.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_group_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_sequence_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_style_util.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_transition.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/animation/animation_transition_event.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/debug/debug_renderer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflector.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/platform_reflection_capabilities.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/types.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflector_reader.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/reflection/reflection_capabilities.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/core/src/util/lang.d.ts
/Users/christarasovs/Desktop/dnd-test/src/app/app.module.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/platform-browser.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/private_import_core.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/title.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/tools/tools.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/debug/by.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/facade/collection.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/debug/ng_probe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_tokens.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/event_manager.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/hammer_gestures.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/security/dom_sanitization_service.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/private_export.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/generic_browser_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/location/browser_platform_location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/common.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/platform_location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/hash_location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/path_location_strategy.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/location/location.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/localization.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/common_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_class.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_for.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_if.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_plural.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_switch.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_style.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/directives/ng_template_outlet.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/async_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/date_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/i18n_plural_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/i18n_select_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/json_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/lowercase_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/number_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/slice_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/pipes/uppercase_pipe.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/common/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/browser/testability.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/dom_events.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/events/key_events.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/web_animations_driver.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/web_animations_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/dom/dom_animate_player.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/platform-browser/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/forms.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/abstract_control_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/facade/async.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/model.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/validators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/abstract_form_group_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/control_container.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/form_interface.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_control.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/checkbox_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/default_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_control_status.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_form.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_model.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/ng_model_group.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/radio_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_control_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_control_name.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_group_directive.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/reactive_directives/form_group_name.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/select_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/directives/select_multiple_control_value_accessor.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/form_builder.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/validators.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/forms/src/form_providers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/index.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/browser_xhr.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/jsonp_backend.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/base_response_options.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/headers.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/interfaces.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/enums.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/static_request.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/body.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/url_search_params.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/static_response.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/browser_jsonp.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/backends/xhr_backend.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/base_request_options.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/http.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/http_module.d.ts
/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/http/src/version.d.ts
/Users/christarasovs/Desktop/dnd-test/src/app/dnd/dnd.component.ts
/Users/christarasovs/Desktop/dnd-test/src/app/dnd/text/text.component.ts
/Users/christarasovs/Desktop/dnd-test/src/app/ng2-dnd/config/testing-utils.ts
/Users/christarasovs/Desktop/dnd-test/src/app/ng2-dnd/node_modules/@types/jasmine/index.d.ts
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8982:109)
at parseSourceFileWorker (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8942:26)
at Object.parseSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8901:26)
at Object.createSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:8729:29)
at WebpackCompilerHost.getSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/compiler_host.js:210:27)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45861:29)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45792:27)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45903:17
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1116:30)
at processReferencedFiles (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45901:16)
at findSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45886:21)
at processSourceFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45792:27)
at processRootFile (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45696:13)
at /Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45153:60
at Object.forEach (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:1116:30)
at Object.createProgram (/Users/christarasovs/Desktop/dnd-test/node_modules/typescript/lib/typescript.js:45153:16)
at AotPlugin._setupOptions (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:124:28)
at new AotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@ngtools/webpack/src/plugin.js:23:14)
at _createAotPlugin (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getNonAotConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-configs/typescript.js:70:19)
at NgCliWebpackConfig.buildConfig (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/models/webpack-config.js:27:37)
at Class.run (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/tasks/serve.js:37:98)
at check_port_1.checkPort.then.port (/Users/christarasovs/Desktop/dnd-test/node_modules/@angular/cli/commands/serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:109:7)
Chriss-iMac:dnd-test christarasovs$

@istiti

This comment has been minimized.

Show comment
Hide comment
@istiti

istiti Mar 7, 2017

@ChrisTarasovs
can you read this tread please because as said you can find error using this adivce

Adding a console.log(fileName) in the beginning of the createSourceFile function at node_modules/typescript/lib/typescript.js helped me pinpoint the specific file.

istiti commented Mar 7, 2017

@ChrisTarasovs
can you read this tread please because as said you can find error using this adivce

Adding a console.log(fileName) in the beginning of the createSourceFile function at node_modules/typescript/lib/typescript.js helped me pinpoint the specific file.

@ChrisTarasovs

This comment has been minimized.

Show comment
Hide comment
@ChrisTarasovs

ChrisTarasovs Mar 7, 2017

Thank you @istiti I did read and tried several time what was said.
So above function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
I have added console.log(fileName); on line 8724 , right above the function and tried inside the function also.

but than I run ng serve and I get the same issue as I get just the same error.
Don't seem to understand how you can get the ouput of console.log if that is shown in the browser but I can even load the page?

Currently I got
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modules\ang
ular-cli\node_modules\typescript\lib\typescript.js:8980:109)
at parseSourceFileWorker (C:\Users\ctarasovs\AppData\Roaming\npm\node_module
s\angular-cli\node_modules\typescript\lib\typescript.js:8940:26)
at Object.parseSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modul
es\angular-cli\node_modules\typescript\lib\typescript.js:8899:26)
at Object.createSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modu
les\angular-cli\node_modules\typescript\lib\typescript.js:8727:29)
.....

ChrisTarasovs commented Mar 7, 2017

Thank you @istiti I did read and tried several time what was said.
So above function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
I have added console.log(fileName); on line 8724 , right above the function and tried inside the function also.

but than I run ng serve and I get the same issue as I get just the same error.
Don't seem to understand how you can get the ouput of console.log if that is shown in the browser but I can even load the page?

Currently I got
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modules\ang
ular-cli\node_modules\typescript\lib\typescript.js:8980:109)
at parseSourceFileWorker (C:\Users\ctarasovs\AppData\Roaming\npm\node_module
s\angular-cli\node_modules\typescript\lib\typescript.js:8940:26)
at Object.parseSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modul
es\angular-cli\node_modules\typescript\lib\typescript.js:8899:26)
at Object.createSourceFile (C:\Users\ctarasovs\AppData\Roaming\npm\node_modu
les\angular-cli\node_modules\typescript\lib\typescript.js:8727:29)
.....

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Mar 4, 2018

Member

@nikdo I'm not too sure really. If I had to bet, it was to ensure new files would be picked up on reload. Do you have a repro we can follow to see this?

Member

filipesilva commented Mar 4, 2018

@nikdo I'm not too sure really. If I had to bet, it was to ensure new files would be picked up on reload. Do you have a repro we can follow to see this?

@nagarajhubli

This comment has been minimized.

Show comment
Hide comment
@nagarajhubli

nagarajhubli Mar 7, 2018

In my case, bower was configured to install bower dependencies at src/assets/bower_components, so had to exclude bower_components from auto type acquisition, as the typescript compilation was looking for typescript declarations (*.d.ts) for those files, and it wasn't finding them.

In tsconfig.app.json, I excluded assets/bower_components/**/*.*

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts",
    "assets/bower_components/**/*.*"
  ]
}

The above comment by @calebkiage helped me in identifying this issue

So, the general idea of excluding files for which type declarations (*.d.ts) doesn't exist should solve this issue

nagarajhubli commented Mar 7, 2018

In my case, bower was configured to install bower dependencies at src/assets/bower_components, so had to exclude bower_components from auto type acquisition, as the typescript compilation was looking for typescript declarations (*.d.ts) for those files, and it wasn't finding them.

In tsconfig.app.json, I excluded assets/bower_components/**/*.*

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts",
    "assets/bower_components/**/*.*"
  ]
}

The above comment by @calebkiage helped me in identifying this issue

So, the general idea of excluding files for which type declarations (*.d.ts) doesn't exist should solve this issue

@atom2103

This comment has been minimized.

Show comment
Hide comment
@atom2103

atom2103 Mar 9, 2018

Just 4 Info, i had same Problem and i went almost crazy...

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (C:\DEV\AFB\varias-bepro\bepro-frontend\src\main\frontend\node_modules\typescript\lib\typescrip t.js:14652:110)

But you know what the problem was?

at the beginning of one of my .ts file was a line like this:

///<reference path="../../../generated/rest/model/Template.ts"/> import {Component, OnDestroy, OnInit} from '@angular/core'; import {FormGroup} from '@angular/forms';

This caused the error! Without any hint. Nothing. I thought my enviroment is broken, some wrong version or something like that.
I removed the line and it worked. But i still don't know how the line got there in the first place...

I hope it helps somebody.

atom2103 commented Mar 9, 2018

Just 4 Info, i had same Problem and i went almost crazy...

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (C:\DEV\AFB\varias-bepro\bepro-frontend\src\main\frontend\node_modules\typescript\lib\typescrip t.js:14652:110)

But you know what the problem was?

at the beginning of one of my .ts file was a line like this:

///<reference path="../../../generated/rest/model/Template.ts"/> import {Component, OnDestroy, OnInit} from '@angular/core'; import {FormGroup} from '@angular/forms';

This caused the error! Without any hint. Nothing. I thought my enviroment is broken, some wrong version or something like that.
I removed the line and it worked. But i still don't know how the line got there in the first place...

I hope it helps somebody.

@tmrdurgun

This comment has been minimized.

Show comment
Hide comment
@tmrdurgun

tmrdurgun Mar 17, 2018

It seems to be an issiue of file/files cannot find in app. I spent some 2-3 hours but resolved with including environments directory to project re-install from repo etc.

tmrdurgun commented Mar 17, 2018

It seems to be an issiue of file/files cannot find in app. I spent some 2-3 hours but resolved with including environments directory to project re-install from repo etc.

@dually8

This comment has been minimized.

Show comment
Hide comment
@dually8

dually8 Mar 21, 2018

@lychyi 's comment worked for me. Hope this issue is resolved soon.

dually8 commented Mar 21, 2018

@lychyi 's comment worked for me. Hope this issue is resolved soon.

@FlexWilliams

This comment has been minimized.

Show comment
Hide comment
@FlexWilliams

FlexWilliams Mar 22, 2018

Thanks for pointing me in the right direction @tmrdurgun . I'm currently in a nrwl project and was adding an environment file path to the wrong app object config.

Thanks for pointing me in the right direction @tmrdurgun . I'm currently in a nrwl project and was adding an environment file path to the wrong app object config.

@rvraaphorst

This comment has been minimized.

Show comment
Hide comment
@rvraaphorst

rvraaphorst Mar 25, 2018

Had the same issue, turned out that in node_modules/typescript/lib/typescript.js (line 12619) the sourceText variable was undefined somehow (function code below) . It pointed to the src/environments/environment.ts file (that existed) while the .angular-cli.json dev environment pointed to environments/environment.dev.ts (that existed too). (ng serve --env=dev was executed)
Setting the .angular-cli.json dev environment to environments/environment.ts solved the problem for now.

package.json:

...
"devDependencies": {
		"@angular/cli": "~1.7.2",
		"@angular/compiler-cli": "^5.2.0",
		"@angular/language-service": "^5.2.0",
		"@types/jasmine": "~2.8.3",
		"@types/jasminewd2": "~2.0.2",
		"jasmine-core": "~2.8.0",
		"jasmine-spec-reporter": "~4.2.1",
		"karma": "~2.0.0",
		"karma-chrome-launcher": "~2.2.0",
		"karma-coverage-istanbul-reporter": "^1.2.1",
		"karma-jasmine": "~1.1.0",
		"karma-jasmine-html-reporter": "^0.2.2",
		"protractor": "~5.1.2",
		"typescript": "~2.5.3"
	}
function createSourceFile(fileName, languageVersion, scriptKind) {
            // code from createNode is inlined here so createNode won't have to deal with special case of creating source files
            // this is quite rare comparing to other nodes and createNode should be as fast as possible
            var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); 
            nodeCount++;
            sourceFile.text = sourceText;
            sourceFile.bindDiagnostics = [];`
            ...
}  

Had the same issue, turned out that in node_modules/typescript/lib/typescript.js (line 12619) the sourceText variable was undefined somehow (function code below) . It pointed to the src/environments/environment.ts file (that existed) while the .angular-cli.json dev environment pointed to environments/environment.dev.ts (that existed too). (ng serve --env=dev was executed)
Setting the .angular-cli.json dev environment to environments/environment.ts solved the problem for now.

package.json:

...
"devDependencies": {
		"@angular/cli": "~1.7.2",
		"@angular/compiler-cli": "^5.2.0",
		"@angular/language-service": "^5.2.0",
		"@types/jasmine": "~2.8.3",
		"@types/jasminewd2": "~2.0.2",
		"jasmine-core": "~2.8.0",
		"jasmine-spec-reporter": "~4.2.1",
		"karma": "~2.0.0",
		"karma-chrome-launcher": "~2.2.0",
		"karma-coverage-istanbul-reporter": "^1.2.1",
		"karma-jasmine": "~1.1.0",
		"karma-jasmine-html-reporter": "^0.2.2",
		"protractor": "~5.1.2",
		"typescript": "~2.5.3"
	}
function createSourceFile(fileName, languageVersion, scriptKind) {
            // code from createNode is inlined here so createNode won't have to deal with special case of creating source files
            // this is quite rare comparing to other nodes and createNode should be as fast as possible
            var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); 
            nodeCount++;
            sourceFile.text = sourceText;
            sourceFile.bindDiagnostics = [];`
            ...
}  
@PaloMiklo

This comment has been minimized.

Show comment
Hide comment
@PaloMiklo

PaloMiklo Mar 27, 2018

I ran into this error, finally, I found out it was because a typo (exclamation mark inside the string interpolation). I wrote:

'Server with ID {{ serverId }} is {{ serverStatus! }}'

instead of

'Server with ID {{ serverId }} is {{ serverStatus }}!'

PaloMiklo commented Mar 27, 2018

I ran into this error, finally, I found out it was because a typo (exclamation mark inside the string interpolation). I wrote:

'Server with ID {{ serverId }} is {{ serverStatus! }}'

instead of

'Server with ID {{ serverId }} is {{ serverStatus }}!'

@realappie

This comment has been minimized.

Show comment
Hide comment
@realappie

realappie Mar 29, 2018

Simply delete a component folder and the angular-cli will detect the change and try to recompile. The code seems to link to a createSourceFile function in typescript.js

var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);

I assume typescript is getting passed a file that doesn't exist anymore and fails to create it?

Edit: seems that this problem occurs whenever a non existing file attempts to get compiled by typescript.

realappie commented Mar 29, 2018

Simply delete a component folder and the angular-cli will detect the change and try to recompile. The code seems to link to a createSourceFile function in typescript.js

var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);

I assume typescript is getting passed a file that doesn't exist anymore and fails to create it?

Edit: seems that this problem occurs whenever a non existing file attempts to get compiled by typescript.

@ankitsindhu

This comment has been minimized.

Show comment
Hide comment
@ankitsindhu

ankitsindhu Apr 3, 2018

There might be an issue with environment.ts file.
check if it is really-
export const environment = {
production: false,

dialogflow: {
angularBot: 'YOUR_CLIENT_TOKEN'
}
};

There might be an issue with environment.ts file.
check if it is really-
export const environment = {
production: false,

dialogflow: {
angularBot: 'YOUR_CLIENT_TOKEN'
}
};

@ankitsindhu

This comment has been minimized.

Show comment
Hide comment
@ankitsindhu

ankitsindhu Apr 3, 2018

I did this change and it worked for me.

I did this change and it worked for me.

@jakubatig

This comment has been minimized.

Show comment
Hide comment
@jakubatig

jakubatig Apr 10, 2018

@filipesilva Can confirm what @nikdo said, and we fixed by downgrading cli to 1.6.1. I can get some time early next week to debug a little or see if our package.json yields a repro. Mention me if that would help.

@filipesilva Can confirm what @nikdo said, and we fixed by downgrading cli to 1.6.1. I can get some time early next week to debug a little or see if our package.json yields a repro. Mention me if that would help.

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Apr 10, 2018

Member

angular/devkit#667 should fix this in 6.0 by failing early when the specified environment file (it will be called fileReplacements in v6) does not exist.

Member

filipesilva commented Apr 10, 2018

angular/devkit#667 should fix this in 6.0 by failing early when the specified environment file (it will be called fileReplacements in v6) does not exist.

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 11, 2018

fix(@angular-devkit/build-angular): validate fileReplacements
Also changes 'src' to 'source', but retains backwards compat.

Fix angular/angular-cli#5053

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 11, 2018

fix(@angular-devkit/build-angular): validate fileReplacements
Also changes 'src' to 'source', but retains backwards compat.

Fix angular/angular-cli#5053

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 12, 2018

fix(@angular-devkit/build-angular): validate fileReplacements
Also changes 'src' to 'source', but retains backwards compat.

Fix angular/angular-cli#5053

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 12, 2018

@filipesilva filipesilva added this to the v6.0.0 milestone Apr 12, 2018

@hansl hansl changed the title from ERROR in Cannot read property 'length' of undefined to Using invalid environment causes error in build (was "ERROR in Cannot read property 'length' of undefined") Apr 12, 2018

@hansl

This comment has been minimized.

Show comment
Hide comment
@hansl

hansl Apr 12, 2018

Collaborator

Marking this nice to have because there seems to be a fix already.

Collaborator

hansl commented Apr 12, 2018

Marking this nice to have because there seems to be a fix already.

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 12, 2018

@hansl hansl removed this from the v6.0.0 milestone Apr 12, 2018

filipesilva added a commit to filipesilva/devkit that referenced this issue Apr 12, 2018

@ali-himindz

This comment has been minimized.

Show comment
Hide comment
@ali-himindz

ali-himindz Apr 12, 2018

I created this patch for version 1.7.3 , you can apply the patch to node_modules/@ngtools/webpack/src/plugin.js and you should be good to go.

493c492,494
<             this._discoveredLazyRoutes = this._getLazyRoutesFromNgtools();
---
>             this._discoveredLazyRoutes = this.firstRun
>                 ? this._getLazyRoutesFromNgtools()
>                 : this._findLazyRoutesInAst();

I created this patch for version 1.7.3 , you can apply the patch to node_modules/@ngtools/webpack/src/plugin.js and you should be good to go.

493c492,494
<             this._discoveredLazyRoutes = this._getLazyRoutesFromNgtools();
---
>             this._discoveredLazyRoutes = this.firstRun
>                 ? this._getLazyRoutesFromNgtools()
>                 : this._findLazyRoutesInAst();

hansl added a commit to angular/devkit that referenced this issue Apr 12, 2018

@Blazzze

This comment has been minimized.

Show comment
Hide comment
@Blazzze

Blazzze Apr 17, 2018

To me removing comments from the environments files worked 👍 🔢

Blazzze commented Apr 17, 2018

To me removing comments from the environments files worked 👍 🔢

@VitalyName

This comment has been minimized.

Show comment
Hide comment
@VitalyName

VitalyName Apr 28, 2018

I solved this problem (error during refactoring test). All is good for angular v4.3.* and v4.4*

  1. Change @angular/cli" version 1.7.3 to 1.4.10 in package.json (latest for angular4)
  2. rm -rf node_modules
  3. npm install --no-optional

I solved this problem (error during refactoring test). All is good for angular v4.3.* and v4.4*

  1. Change @angular/cli" version 1.7.3 to 1.4.10 in package.json (latest for angular4)
  2. rm -rf node_modules
  3. npm install --no-optional
@Tomek6789

This comment has been minimized.

Show comment
Hide comment
@Tomek6789

Tomek6789 May 5, 2018

I have the exact same problem as @FunnyGhost (angular-cli 1.7.0, angular 2.4.10 typescript 2.2.2). Downgrading the angular-cli to 1.6.1 resolved my problem, but version 1.6.1 required angular-devkit/core in devDependencties

Tomek6789 commented May 5, 2018

I have the exact same problem as @FunnyGhost (angular-cli 1.7.0, angular 2.4.10 typescript 2.2.2). Downgrading the angular-cli to 1.6.1 resolved my problem, but version 1.6.1 required angular-devkit/core in devDependencties

@atariman5000

This comment has been minimized.

Show comment
Hide comment
@atariman5000

atariman5000 May 10, 2018

I too like others found the problem to be with the "plugin.js" file within "node_modules@ngtools\webpack\src\plugin.js". The problem is with the "_findLazyRoutesInAst()" function. This function is called on the second pass when running your unit test (w/ Karma). This function only looks at files that have been modified, and there is a file path in the array "this._compilerHost.getChangedFilePaths()" that ends with "/src", and all of the other paths end with .ts files. To resolve this problem, I check the file path to see if it ends with ".ts", and if so, I push that path into an array. Below is my solution to this problem. I would like to submit this as a bug fix, but I do not know where to do so.

------- plugin.js : ln 211 -------

_findLazyRoutesInAst() {
benchmark_1.time('AotPlugin._findLazyRoutesInAst');
const result = Object.create(null);
var changedFilePaths = [];
this._compilerHost.getChangedFilePaths().forEach(f => {
if(f.endsWith(".ts")) {
changedFilePaths.push(f);
}
});
for (const filePath of changedFilePaths) {
const fileLazyRoutes = lazy_routes_1.findLazyRoutes(filePath, this._compilerHost, this._program);

I too like others found the problem to be with the "plugin.js" file within "node_modules@ngtools\webpack\src\plugin.js". The problem is with the "_findLazyRoutesInAst()" function. This function is called on the second pass when running your unit test (w/ Karma). This function only looks at files that have been modified, and there is a file path in the array "this._compilerHost.getChangedFilePaths()" that ends with "/src", and all of the other paths end with .ts files. To resolve this problem, I check the file path to see if it ends with ".ts", and if so, I push that path into an array. Below is my solution to this problem. I would like to submit this as a bug fix, but I do not know where to do so.

------- plugin.js : ln 211 -------

_findLazyRoutesInAst() {
benchmark_1.time('AotPlugin._findLazyRoutesInAst');
const result = Object.create(null);
var changedFilePaths = [];
this._compilerHost.getChangedFilePaths().forEach(f => {
if(f.endsWith(".ts")) {
changedFilePaths.push(f);
}
});
for (const filePath of changedFilePaths) {
const fileLazyRoutes = lazy_routes_1.findLazyRoutes(filePath, this._compilerHost, this._program);

@pierremalaga

This comment has been minimized.

Show comment
Hide comment
@pierremalaga

pierremalaga May 17, 2018

I have modified this file and it works fine, but it will never be fixed in any new version?
This is my solution, it's similar to @ atariman5000 but inside an for:

_findLazyRoutesInAst() {
  benchmark_1.time('AotPlugin._findLazyRoutesInAst');`
  const result = Object.create(null);`
  const changedFilePaths = this._compilerHost.getChangedFilePaths();`

  for (const filePath of changedFilePaths) {
 >> if(filePath.match(/.*\/*\.[A-Za-z]*$/)) {
      const fileLazyRoutes = lazy_routes_1.findLazyRoutes(filePath, this._compilerHost, this._program);
      for (const routeKey of Object.keys(fileLazyRoutes)) {
        const route = fileLazyRoutes[routeKey];
        if (routeKey in this._lazyRoutes) {
          if (route === null) {
             this._lazyRoutes[routeKey] = null;
          }
          else if (this._lazyRoutes[routeKey] !== route) {
             this._compilation.warnings.push(new Error(`Duplicated path in loadChildren detected during a rebuild. `
                    + `We will take the latest version detected and override it to save rebuild time. `
                    + `You should perform a full build to validate that your routes don't overlap.`));
           }
         }
         else {
            result[routeKey] = route;
         }
      }
    }
  }
  benchmark_1.timeEnd('AotPlugin._findLazyRoutesInAst');
  return result;
} 

I have modified this file and it works fine, but it will never be fixed in any new version?
This is my solution, it's similar to @ atariman5000 but inside an for:

_findLazyRoutesInAst() {
  benchmark_1.time('AotPlugin._findLazyRoutesInAst');`
  const result = Object.create(null);`
  const changedFilePaths = this._compilerHost.getChangedFilePaths();`

  for (const filePath of changedFilePaths) {
 >> if(filePath.match(/.*\/*\.[A-Za-z]*$/)) {
      const fileLazyRoutes = lazy_routes_1.findLazyRoutes(filePath, this._compilerHost, this._program);
      for (const routeKey of Object.keys(fileLazyRoutes)) {
        const route = fileLazyRoutes[routeKey];
        if (routeKey in this._lazyRoutes) {
          if (route === null) {
             this._lazyRoutes[routeKey] = null;
          }
          else if (this._lazyRoutes[routeKey] !== route) {
             this._compilation.warnings.push(new Error(`Duplicated path in loadChildren detected during a rebuild. `
                    + `We will take the latest version detected and override it to save rebuild time. `
                    + `You should perform a full build to validate that your routes don't overlap.`));
           }
         }
         else {
            result[routeKey] = route;
         }
      }
    }
  }
  benchmark_1.timeEnd('AotPlugin._findLazyRoutesInAst');
  return result;
} 
@finalsnd

This comment has been minimized.

Show comment
Hide comment
@finalsnd

finalsnd May 26, 2018

I had a similar message recently when I added some new environments files in the angular-cli.json

        "prod": "environments/environment.prod.ts",
        "xamp": "environments/environment.xamp..ts"

The problem was I misstyped the name of one of the files: environment.xamp**.**.ts (I typed twice the dot)

I was very hard to figure what was wrong with my project (I knew only it had to be something with the environments files). A nice error sugesting about how i misspelled the files would have been perfect :/

finalsnd commented May 26, 2018

I had a similar message recently when I added some new environments files in the angular-cli.json

        "prod": "environments/environment.prod.ts",
        "xamp": "environments/environment.xamp..ts"

The problem was I misstyped the name of one of the files: environment.xamp**.**.ts (I typed twice the dot)

I was very hard to figure what was wrong with my project (I knew only it had to be something with the environments files). A nice error sugesting about how i misspelled the files would have been perfect :/

@mariohmol

This comment has been minimized.

Show comment
Hide comment
@mariohmol

mariohmol Jun 1, 2018

This error should be improved.. for instance.. in most of the cases is the environment.xxx.ts missing.. so a message where file could not be found would be nice!

This error should be improved.. for instance.. in most of the cases is the environment.xxx.ts missing.. so a message where file could not be found would be nice!

@dhruvaldarji

This comment has been minimized.

Show comment
Hide comment
@dhruvaldarji

dhruvaldarji Jun 5, 2018

My team has been struggling with this for months, but @mhamel06's comment resolved the issue for me. It would be nice to have an actual fix that doesn't require modification of a lib file though.

My team has been struggling with this for months, but @mhamel06's comment resolved the issue for me. It would be nice to have an actual fix that doesn't require modification of a lib file though.

hansl added a commit that referenced this issue Jun 6, 2018

@mittinatten

This comment has been minimized.

Show comment
Hide comment
@mittinatten

mittinatten Jun 6, 2018

The variant of the problem described by @FunnyGhost in #5053 (comment) is gone in 6.0.7.

The variant of the problem described by @FunnyGhost in #5053 (comment) is gone in 6.0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment