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_profileand.bashrc
- Here is a screenshot where you can see I do have a
ng completion >> ~/.bashrc ..May be there is a bug is somewhere...
But @sgwatgit
ng completion | cat >> ~/.bashrc
works fine for me...
@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.
[2K[1G[?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.
I forget to mention about that..It's the problem with angular-cli...look what ng --version is giving you..!
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
@jkuri: please take a look at completion. Seems to not be working anymore
Fix is coming
I get the same TypeError: Cannot read property 'defaultEncoding' of undefined with ng completion >> ~/.bashrc on Mac OS X
$ ng version
(node:5709) 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.5
node: 6.2.0
os: darwin x64
Not sure if this might help anyone who's running in to this issue, but this happened to work for me just a few minutes ago...
I ran in to this same issue trying to run ng completion >> ~/.bashrc, with no such luck.
$ ng -v
(node:25662) 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.5
node: 6.2.1 /** I also tried on v6.1.0 & v6.2.0 **/
os: darwin x64
Then I downgraded to v5.4.1, it installed with no issues whatsoever.
$ ng -v
angular-cli: 1.0.0-beta.5
node: 5.4.1
os: darwin x64
Downgrading node also eliminated the 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. message as well. Believe that's a well known thing by now, giving developers a chance to update their packages to support node v6.x.x.
Thanks
Same issue
$ ng -v
(node:45767) 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.6
node: 6.2.1
os: darwin x64
@brucebentley thanks for the insight. It makes me thing it's due to a change in node6, which is a good start to investigate.
As others have alluded to above, the problem (for me) was that the fs: re-evaluating... warning got sent to the rc file. When I manually removed that, it worked fine.
Problem still seems to exist. Only happens on redirection to the file. ng completion prints it to console with preceding fs: re-evaluating... messages
$ ng -v
(node:32884) 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.10
node: 6.3.0
os: darwin x64
$ ng completion >> ~/.bash_profile
_stream_writable.js:211
encoding = state.defaultEncoding;
^
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 (/usr/local/lib/node_modules/angular-cli/lib/cli/index.js:91:27)
at Console.warn (console.js:51:16)
at printDeprecation (evalmachine.<anonymous>:70:15)
at evalmachine.<anonymous>:74:3
at Object.<anonymous> (/usr/local/lib/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:458:32)
$ ng completion
(node:29329) 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.
###-begin-ng-completion###
#
# ng command completion script
#
# Installation: ng completion >> ~/.bashrc (or ~/.zshrc)
#
ng_opts='new init build serve generate autocomplete e2e lint test version'
init_opts='--dry-run --verbose --blueprint --skip-npm --skip-bower --name'
new_opts='--dry-run --verbose --blueprint --skip-npm --skip-bower --skip-git --directory'
build_opts='--environment --output-path --watch --watcher'
serve_opts='--port --host --proxy --insecure-proxy --watcher --live-reload --live-reload-host
--live-reload-port --environment --output-path --ssl --ssl-key --ssl-cert'
generate_opts='component directive pipe route service'
test_opts='--watch --browsers --colors --log-level --port --reporters'
if type complete &>/dev/null; then
_ng_completion() {
local cword pword opts
COMPREPLY=()
cword=${COMP_WORDS[COMP_CWORD]}
pword=${COMP_WORDS[COMP_CWORD - 1]}
case ${pword} in
ng) opts=$ng_opts ;;
i|init) opts=$init_opts ;;
new) opts=$new_opts ;;
b|build) opts=$build_opts ;;
s|serve|server) opts=$serve_opts ;;
g|generate) opts=$generate_opts ;;
test) opts=$test_opts ;;
esac
COMPREPLY=( $(compgen -W '${opts}' -- $cword) )
return 0
}
complete -o default -F _ng_completion ng
elif type compctl &>/dev/null; then
_ng_completion () {
local words cword opts
read -Ac words
read -cn cword
let cword-=1
case $words[cword] in
ng) opts=$ng_opts ;;
i|init) opts=$init_opts ;;
new) opts=$new_opts ;;
b|build) opts=$build_opts ;;
s|serve|server) opts=$serve_opts ;;
g|generate) opts=$generate_opts ;;
test) opts=$test_opts ;;
esac
setopt shwordsplit
reply=($opts)
unset shwordsplit
}
compctl -K _ng_completion ng
fi
###-end-ng-completion###
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.
Is this still an issue ? Personally, I never had to install watchman.
Closing this as deprecated.
No plans for autocompletion? Just stumbled upon the comment that it's missing here: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng
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.