nvm npm Error: segmentation fault [How to Solve]

Background

After NVM use switches the node version, NPM reports an error segmentation fault

My solution

sudo apt autoremove npm

Note: it must be autoremove, not remove. Remove is not completely cleared

Cause guess

There is a global NPM. The configuration of the global NPM affects the configuration of the NPM version corresponding to the node installed by the NVM

Read More: