Angular-cli: Web cannot run after update angular cli to 6.1.0

Created on 26 Jul 2018  路  18Comments  路  Source: angular/angular-cli

Web cannot run after update angular cli to 6.1.0

Command (mark with an x)

--update angular cli---
npm i -g npm
npm install -g typescript
npm install -g @angular/cli
npm install

---run application---
ng serve --open

Versions


node v8.11.2
npm v6.2.0
ng version

Angular CLI: 6.1.0
Node: 8.11.2
OS: win32 x64
Angular:
...

Package Version

@angular-devkit/architect 0.7.0
@angular-devkit/core 0.7.0
@angular-devkit/schematics 0.7.0
@schematics/angular 0.7.0
@schematics/update 0.7.0
rxjs 6.2.2
typescript 2.7.2

The log given by the failure


Cannot read property 'write' of undefined
TypeError: Cannot read property 'write' of undefined
at UI.write (viewernode_modules\@angular\cli\ember-cli\lib\ui\index.js:56:23)
at UI.writeLine (viewernode_modules\@angular\cli\ember-cli\lib\ui\index.js:69:8)
at Class.run (viewernode_modules\@angular\cli\tasks\serve.js:237:12)
at check_port_1.checkPort.then.port (viewernode_modules\@angular\cli\commands\serve.js:123:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

Most helpful comment

It's certainly related to angular-cli latest release - 6.1.0 and 6.1.1 yesterday.

My workaround was downgraded angular-cli to 6.0.8.

$ ng serve
Your global Angular CLI version (6.1.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Cannot read property 'write' of undefined
TypeError: Cannot read property 'write' of undefined
    at UI.write (/Users/axa/workspace/sense/web/node_modules/@angular/cli/ember-cli/lib/ui/index.js:56:23)
    at UI.writeLine (/Users/axa/workspace/sense/web/node_modules/@angular/cli/ember-cli/lib/ui/index.js:69:8)
    at Class.run (/Users/axa/workspace/sense/web/node_modules/@angular/cli/tasks/serve.js:237:12)
    at check_port_1.checkPort.then.port (/Users/axa/workspace/sense/web/node_modules/@angular/cli/commands/serve.js:123:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

[[[ RESOLUTION HERE ]]]
$ sudo -s npm uninstall -g @angular/cli
$ sudo -s npm install -g @angular/[email protected]
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> [email protected] install /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> @angular/[email protected] postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/ng-update-message.js

+ @angular/[email protected]
added 314 packages from 208 contributors in 4.595s

axa 馃尋  gcloud@sense in ~/workspace/sense/web on master [?]
$ ng serve
Your global Angular CLI version (6.0.8) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-07-27T07:44:48.741Z
Hash: 3213f8632590f1521de1
Time: 22632ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 3.46 MB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 1.09 MB [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 1.09 MB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 2.48 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 24.9 MB [initial] [rendered]

webpack: Compiled successfully.

axa 馃尋  gcloud@sense in ~/workspace/sense/web on master [?]

All 18 comments

so do we. same error!

@dejobo @yeah007 I have downgraded ng CLI to 6.0.8 and it works for me.

Hi @yeah007 ,

Are you sure you are running ng version inside your project? We do not have nor publish an ember-cli folder anymore, since 6.0.0, so I'm pretty sure this is a version mismatch and something is not right in your node_modules.

I'm going to close this issue as not a bug. If you cannot figure out the error, please file a new issue and share your package.json and a proper ng version run from the project directory (we want to know what the local version is).

@hansl same happend to me :(
I've tryed ng version
same error:

Cannot read property 'write' of undefined
TypeError: Cannot read property 'write' of undefined
at UI.write (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cliember-cli\lib\ui\index.js:56:23)
at UI.writeLine (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cliember-cli\lib\ui\index.js:69:8)
at Class.run (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cli\commands\version.js:71:17)
at resolve (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cliember-cli\lib\models\command.js:261:20)
at new Promise ()
at Class.validateAndRun (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cliember-cli\lib\models\command.js:240:12)
at Promise.resolve.then.then (C:\devGoldmineGoldMineWebAppnode_modules\@angular\cliember-cli\lib\cli\cli.js:140:24)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)

Same error when run the command: ng build --prod --aot

I got this error and it seems to stem from the fact that I have an older version of ng cli on the project vs the version of ng cli installed globally.

I was able to fix this by updating the local ng cli version manually and then migrating it by running:

npm install --save-dev @angular/[email protected]
yarn add -D @angular/[email protected] # if you use yarn

ng update @angular/cli --migrate-only --from=1.7.4

For CI builds, it may be worthwhile to invoke ./node_modules/.bin/ng instead of installing @angular/cli globally.

@Aenigma
ng update @angular/cli --migrate-only --from=1.7.4 didn't work .
actually ng -v gives the same error.

same for me...include ng -v gives the error.

npm -v
6.2.0

node -v
v10.7.0

the code

ng update @angular/cli --migrate-only --from=1.7.4
isn't work, I've got this error:

image

It's certainly related to angular-cli latest release - 6.1.0 and 6.1.1 yesterday.

My workaround was downgraded angular-cli to 6.0.8.

$ ng serve
Your global Angular CLI version (6.1.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Cannot read property 'write' of undefined
TypeError: Cannot read property 'write' of undefined
    at UI.write (/Users/axa/workspace/sense/web/node_modules/@angular/cli/ember-cli/lib/ui/index.js:56:23)
    at UI.writeLine (/Users/axa/workspace/sense/web/node_modules/@angular/cli/ember-cli/lib/ui/index.js:69:8)
    at Class.run (/Users/axa/workspace/sense/web/node_modules/@angular/cli/tasks/serve.js:237:12)
    at check_port_1.checkPort.then.port (/Users/axa/workspace/sense/web/node_modules/@angular/cli/commands/serve.js:123:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

[[[ RESOLUTION HERE ]]]
$ sudo -s npm uninstall -g @angular/cli
$ sudo -s npm install -g @angular/[email protected]
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> [email protected] install /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> @angular/[email protected] postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/ng-update-message.js

+ @angular/[email protected]
added 314 packages from 208 contributors in 4.595s

axa 馃尋  gcloud@sense in ~/workspace/sense/web on master [?]
$ ng serve
Your global Angular CLI version (6.0.8) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-07-27T07:44:48.741Z
Hash: 3213f8632590f1521de1
Time: 22632ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 3.46 MB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 1.09 MB [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 1.09 MB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 2.48 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 24.9 MB [initial] [rendered]

webpack: Compiled successfully.

axa 馃尋  gcloud@sense in ~/workspace/sense/web on master [?]

@axacheng it works for me.

My problem was a little bit difference, I've got 'angular.json' error after execute these steps.
To solution the problem, I've execute the followings commands at terminal:

1 - npm un @angular/[email protected] -g --save
2 - npm i @angular/[email protected] -g --save

After that, I've got something like this:

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.

So I've execute:

ng update @angular/cli --migrate-only --from=1.7.4

and ng serve works!

Yes, it works after revert to 6.0.8. It seems a issue of 6.1.0.

@axacheng thank you very much it's worked with me

6.1.1 keep this error

@azulay7 I updated my previous comment. I failed to mention, because I didn't realize it was significant, that I first updated Angular CLI manually and then I ran ng update. This approach should let you safely upgrade to the latest version of Angular CLI.

npm install --save-dev @angular/[email protected]
# now, ng version should work
ng update @angular/cli --migrate-only --from=1.7.4

thank @Aenigma @marcosrodriigues. works for me!

@marcosrodriigues thanks that worked

Issue has been fixed in v 6.1.4
npm update -g @angular/cli

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajjejosefsson picture rajjejosefsson  路  3Comments

hartjo picture hartjo  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

donaldallen picture donaldallen  路  3Comments

purushottamjha picture purushottamjha  路  3Comments