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

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 (viewer\node_modules@angular\cli\ember-cli\lib\ui\index.js:56:23) at UI.writeLine (viewer\node_modules@angular\cli\ember-cli\lib\ui\index.js:69:8) at Class.run (viewer\node_modules@angular\cli\tasks\serve.js:237:12) at check_port_1.checkPort.then.port (viewer\node_modules@angular\cli\commands\serve.js:123:26) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 18 (1 by maintainers)

Most upvoted comments

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/cli@6.0.8
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> fsevents@1.2.4 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/cli@6.0.8 postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/ng-update-message.js

+ @angular/cli@6.0.8
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 [?]

so do we. same error!

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

@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/cli@6.1.1
# now, ng version should work
ng update @angular/cli --migrate-only --from=1.7.4

@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/cli@6.1.0 -g --save 2 - npm i @angular/cli@6.0.8 -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.

6.1.1 keep this error

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/cli@6.1.1
yarn add -D @angular/cli@6.1.1 # 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.

@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:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\ember-cli\lib\ui\index.js:56:23) at UI.writeLine (C:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\ember-cli\lib\ui\index.js:69:8) at Class.run (C:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\commands\version.js:71:17) at resolve (C:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\ember-cli\lib\models\command.js:261:20) at new Promise (<anonymous>) at Class.validateAndRun (C:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\ember-cli\lib\models\command.js:240:12) at Promise.resolve.then.then (C:\dev\Goldmine\GoldMineWebApp\node_modules@angular\cli\ember-cli\lib\cli\cli.js:140:24) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) at Function.Module.runMain (module.js:695:11)