When I try common Internet shell snippets to quickly delete all my (global) NPM packages, then npm becomes corrupted. Commands like npm install [-g] and npm ls [-g] no longer produce any output, though they do quietly emit non-zero exit codes.
npm commands should not fail quietly, but always emit an error trace (to stderr). Between asdf-nodejs, plain NPM, and the questionable behavior of dozens of these snippets, not sure where the root cause of the NPM corruption lies.
NPM should implement a built-in command to automate deleting all packages. The fact that we have so many (failed) attempts by users to write portable, awk hacks to do this demonstrates the need for a built-in feature.
As a workaround, I am using asdf uninstall nodejs <version>, asdf install (from .tool-versions) to fix the corruption.
When I try common Internet shell snippets to quickly delete all my (global) NPM packages, then
npm
becomes corrupted. Commands likenpm install [-g]
andnpm ls [-g]
no longer produce any output, though they do quietly emit non-zero exit codes.https://stackoverflow.com/questions/9283472/command-to-remove-all-npm-modules-globally
npm
commands should not fail quietly, but always emit an error trace (to stderr). Between asdf-nodejs, plain NPM, and the questionable behavior of dozens of these snippets, not sure where the root cause of the NPM corruption lies.As a workaround, I am using
asdf uninstall nodejs <version>
,asdf install
(from.tool-versions
) to fix the corruption.