Angular-cli: Angular-cli doesn't uninstall cleanly

Created on 3 Aug 2016  路  4Comments  路  Source: angular/angular-cli

On my Windows 7 machine, I'm unable to uninstall an existing _angular-cli_ instance following the approach outlined here.

> ng --version
angular-cli: 1.0.0-beta.8
node: 4.4.7
os: win32 x64

Run uninstall commands:

npm uninstall -g angular-cli
npm cache clean

The uninstall statement doesn't report any errors. Nevertheless, the ng --version command still reports the same information as before (even in a new command-shell or _PowerShell_ instance and/or after a reboot).

And finally after executing npm install -g angular-cli@webpack the same CLI version is still reported. And new projects subsequently created with the CLI still use System.js rather than Webpack for module bundling.

Whereas ng --version still lists angular-cli: 1.0.0-beta.8, npm ls -g --depth=0 reports [email protected].

It's unclear why the uninstall process is not working. I'm running the ng commands in a non-project folder (i.e., where there are no local modules).

Any ideas?

Most helpful comment

Similar happened to me after installing nvm (node modules were moved from /usr/local/lib/node_modules/ into ~/.nvm/lib). After doing so, npm uninstall -g didn't work, naturally. Additionally, the ng binary was owned by root.

To correct this, I ultimately did the following:

# reports old version even though angular-cli doesn't appear in `npm -g list`
ng -v
# install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
# exit (restart the CLI to clear env variables)
# uninstall the ng binary since it's owned by root (try `which ng` to find it)
rm -rf /usr/local/bin/ng
# deleted this for good measure since I'm now using .nvm
rm -rf /usr/local/lib/node_modules/angular-cli
# reinstall angular-cli
npm install -g angular-cli
# check the version, which is now correct!
ng -v

All 4 comments

I worked around this issue by uninstalling Node.js from my system. The uninstall process didn't report any errors. However, the following files remained on the system afterward:

    D:\nodejs\ng
    D:\nodejs\ng.cmd
    C:\Users\<username>\AppData\Roaming\npm\ng
    C:\Users\<username>\AppData\Roaming\npm\ng.cmd
    ... other commands

And several packages also remained in the C:\Users\<username>\AppData\Roaming\npm\node_modules\ and D:\nodejs\node_modules\ directories after the uninstall.

So the Node.js/NPM uninstall process was not especially clean. After manually deleting these files and folders and subsequently reinstalling Node and the Webpack version of the Angular CLI, I eventually got it to work. I also had to remove the ^ in "angular-cli": "^1.0.0-beta.11-webpack" in package.json and run npm i again.

This might have been a weird node/npm thing.. maybe with multiple installs over time, you ended up with multiple places where node modules were. Personally I use nvm to deal with that.

Similar happened to me after installing nvm (node modules were moved from /usr/local/lib/node_modules/ into ~/.nvm/lib). After doing so, npm uninstall -g didn't work, naturally. Additionally, the ng binary was owned by root.

To correct this, I ultimately did the following:

# reports old version even though angular-cli doesn't appear in `npm -g list`
ng -v
# install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
# exit (restart the CLI to clear env variables)
# uninstall the ng binary since it's owned by root (try `which ng` to find it)
rm -rf /usr/local/bin/ng
# deleted this for good measure since I'm now using .nvm
rm -rf /usr/local/lib/node_modules/angular-cli
# reinstall angular-cli
npm install -g angular-cli
# check the version, which is now correct!
ng -v

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

rwillmer picture rwillmer  路  3Comments

5amfung picture 5amfung  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

sysmat picture sysmat  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments