17

I'm working on a club project and we are using angular for our platform, I'm just doing front-end homepage stuff, so technically I just use the angular stuff to run and test.

It was working fine but now everytime I run ng build --watch I get this error:

C:\Users\User\Documents\WebstormProjects\MyProject\angular-src\node_modules\@angular\cli\ember-cli\lib\ui\index.js:56
    this.outputStream.write(data);
                      ^

TypeError: Cannot read property 'write' of undefined
    at UI.write (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\@angular\cli\ember-cli\lib\ui\index.js:56:23)
    at UI.writeLine (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\@angular\cli\ember-cli\lib\ui\index.js:69:8)
    at Watching.callback [as handler] (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\@angular\cli\tasks\build.js:44:29)
    at Watching._done (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\Compiler.js:106:8)
    at compiler.emitRecords.err (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\Compiler.js:79:19)
    at Compiler.emitRecords (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\Compiler.js:371:38)
    at compiler.emitAssets.err (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\Compiler.js:62:20)
    at applyPluginsAsyncSeries1.err (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\Compiler.js:364:12)
    at next (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\tapable\lib\Tapable.js:218:11)
    at Compiler.compiler.plugin (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
    at next (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\tapable\lib\Tapable.js:220:14)
    at Compiler.compiler.plugin (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\@ngtools\webpack\src\plugin.js:326:13)
    at next (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\tapable\lib\Tapable.js:220:14)
    at callback (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\copy-webpack-plugin\dist\index.js:126:17)
    at Compiler.afterEmit (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\copy-webpack-plugin\dist\index.js:220:13)
    at Compiler.applyPluginsAsyncSeries1 (C:\Users\user\Documents\WebstormProjects\MyProject\angular-src\node_modules\tapable\lib\Tapable.js:222:13)

I'm totally lost around this, I've tried multiple threads to reinstall node and angular and nothing. I've followed this one in particular: How to uninstall Angular CLI? .

The weirdest part is now when I try to do this on ubuntu by cloning the project, setting the env variables and do npm install, every time I do ng watch build it gives me the same error. But apparently, I'm the only one on the team.

DTek
  • 371
  • 1
  • 5
  • 13

6 Answers6

17

It's because of the new Angular version. Go with the old Angular version:

npm uninstall -g @angular/cli
npm install -g @angular/cli@6.0.8
juzraai
  • 5,693
  • 8
  • 33
  • 47
Abhilash L
  • 171
  • 7
15

Seems to be caused by latest version of Angular CLI (released today). I worked around it by installing previous version (6.0.8) globally.

Update:

As per prionp answer below:

Angular CLI v6.1.2 fixed the issue.

Update your version :

npm update -g @angular/cli
Damián Pereira
  • 305
  • 2
  • 7
6

I have tried to install angular(version 6.1.1 and 6.1.0 and 6.0.9). unfortunately, I have faced error in all of mentioned versions. But, I could install angular 6.0.8 successfully. try this command in your console:

npm uninstall -g @angular/cli 
npm install -g @angular/cli@6.0.8
Ehsan
  • 308
  • 6
  • 17
4

Angular CLI v6.1.2 fixed the issue.

Update your version :

npm update -g @angular/cli
pironp
  • 71
  • 1
  • 3
1

Faced the same issue, its related to both 6.10 and 6.11, one option is to downgrade your @angular/cli to 6.0.8 or to update the local @angular/cli manually

nicmwenda
  • 139
  • 1
  • 3
1

Change @angular/compiler-cli version in your package.json, to the same version as @angular/core and the others.

And then, run an npm update to get the updated version.

Elated Coder
  • 312
  • 1
  • 16