Reputation: 91
My OSX terminal began hanging when I opened a new window and looking at the top of the window, it was taking a long time to exit the ng completion
script. Took about 5 min for the script to exit after I was patient enough.
Several things I tried (not knowing how to solve the issue):
Return
Ctrl+ j
- line feedCtrl + z
- suspendCtrl + c
- interruptCtrl + q
- quitCtrl + s
- restart outputNone of the above worked for me.
What did work:
npm uninstall -g @angular/cli
npm list -g --depth 0
and verify @angular/cli is not in list.npm install -g @angular/cli
Hope this helps someone in the future.
Upvotes: 9
Views: 6516
Reputation: 1
I commented on the below line in my .profile and relaunched the terminal. Now the hang is out.
# Load Angular CLI autocompletion.
source <(ng completion script)
In my system I don't have ng globally so I installed it with the below command
npm install -g @angular/cli
Now I uncommented the commented line in .profile, and now the issue is gone!
I hope it may help someone!
Upvotes: 0
Reputation: 399
This was my response elsewhere, but considering that these "syndromes" are quite similar, such as when the build program hangs on the program (terminal) after a successful build, or when windows or processes often hang on ng completion scripts, causing some pipe commands to fail to continue, when I tried updating Node, all of these symptoms were eliminated. So please consider it as a reference.
The real issue here is the Node version. I'm guessing you might be using the "latest" version of Node, right? When I encountered this issue, it was during local testing, where some of the build commands wouldn't execute because the program (or the terminal at runtime) would get stuck on some supposed "completed" tasks, usually related to the build or strange ng completion scripts. But anyway, this had nothing to do with Angular.
To verify this, I repeatedly uninstalled and installed various versions of Angular CLI, but to no avail. Finally, I suspected it was a Node version issue. At some point, I had updated Node to an unstable odd version, so when I reverted to Node version 18, these problems disappeared.
My system is macOS, and I manage packages using Homebrew. Here's what I did:
brew uninstall node
brew install node@18
After installation, since I had specified the version, I needed to set environment variables to prevent the terminal from not recognizing Node. Usually, you can get a prompt from brew after installing the program, but since I use bash, I modified the .bash_profile file and added:
export PATH="/usr/local/opt/node@18/bin:$PATH"
That's how to handle Node version issues. As for reinstalling Angular CLI, you can do the following:
npm uninstall -g @angular/cli
npm install -g @angular/cli
That should restore Angular CLI to the latest version. Good luck!
Note: It's important to keep in mind that the Node version I specified here is version 18, which was selected specifically to address the issue at this particular point in time.
Upvotes: 4
Reputation: 117
No need to un-install and re-install angular/cli. If you stuck at ng completion script then you can go to activity monitor and quit that process. It will bring your terminal to life.
Later you can go to you .bash or .zshrc profile file whatever you are using to comment out that particular ng completion script.
After this reload the terminal and should work fine.
Hope this helps anyone facing similar issue and saves time.
Upvotes: 9