angular-cli: ng completion (Windows) -> Cannot read property 'defaultEncoding' of undefined

  • OS.
    • Windows 10.0.10586 Pro *. Versions.
$ ng --version                                                                                                                                             
(node:10072) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. 
angular-cli: 1.0.0-beta.0                                                                                                                                  
node: 6.1.0                                                                                                                                                
os: win32 x64                                                                                                                                              
  • Repro steps.
    • Tried to add command completion using the step described in the README. I am using non-Admin/Elevated Git Bash.
ng completion >> ~/.bash_profile
source ~/.bash_profile
  • The log given by the failure.
TypeError: Cannot read property 'defaultEncoding' of undefined
    at SyncWriteStream.Writable.write (_stream_writable.js:211:21)
    at SyncWriteStream.Socket.write (net.js:650:40)
    at WriteStream.process.stderr.write (C:\Users\Sean\AppData\Roaming\npm\node_modules\angular-cli\lib\cli\index.js:87:27)
    at Console.warn (console.js:51:16)
    at printDeprecation (evalmachine.<anonymous>:64:15)
    at evalmachine.<anonymous>:68:3
    at Object.<anonymous> (C:\Users\Sean\AppData\Roaming\npm\node_modules\angular-cli\node_modules\yam\node_modules\graceful-fs\fs.js:11:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
  • Mention any other details that might be useful.
    • Here is a screenshot where you can see I do have a .bash_profile and .bashrc commands-auto-completion-bug

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Problem persists on 1.0.0-beta.1

$ ng -v (node:40160) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info. angular-cli: 1.0.0-beta.1 node: 6.0.0 os: darwin x64

brew install watchman … and … ng completion 2>/dev/null >> ~/.zshrc … did the trick for me.

As watchman is a recommendation for the EmberCli anyway (see https://ember-cli.com/user-guide/#watchman) it makes sense to have it installed for angular-cli also. Maybe it should be mentioned in the CLIs README?

The output piping against /dev/null was needed on my system with node v6.3.1 to get rid of a deprecation warning of graceful-fs.

Fix is coming

I forget to mention about that…It’s the problem with angular-cli…look what ng --version is giving you…!

@ehzShelter Unfortunately ng completion | cat >> ~/.bashrc inserts the following at the bottom of my .bashrc

(node:6472) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[?25h###-begin-ng-completion### 
#
# ng command completion script
#
# Installation: ng completion >> ~/.bashrc (or ~/.zshrc)
#

(With the remainder of the ng command completion script following.)

So this solution would break my .bashrc if I didn’t go in and manually remove the (node:6472) fs... line.