Installing a new program via Terminal or updating versions of npm often comes with errors that appear for no apparent reason. In most cases, the issue is in permissions, or lack of them, to be precise.
We can usually solve this by appending the sudo command. Sudo, an acronym for superuser do, is a command that allows you to run programs with the security privileges of a superuser.
So, if we are talking about updating npm, instead of writing:
npm install -g npm@...
We would write:
sudo npm install -g npm@...
We can test if everything went well by checking the npm version:
npm -v
Leave a comment