Can anyone comment on the correctness of https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally ?
The article seems to suggest you should install global packages in a specific user’s home directory. That seems contradictory to me and doesn’t fix the problems people have with globally installed packages, namely that permissions are not set correctly (see also https://github.com/npm/npm/issues/3849) and as a result they are not usable.
Configuring the global packages directory to not be something like
/usr/lib/node_modules but instead a user’s home directory, as suggested by the “resolving EACCES Permissions” article only solves this problem for that particular user. However, a global package would need to be accessible by all users.
I’m also not clear on how the first “solution” (using a Node Version Manager to install NodeJS and npm - https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-version-manager-to-install-node-js-and-npm) fixes this problem. According to the documentation there, using a Node Version Manager:
allow(s) you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.
That seems like an entirely different issue.
However, if there is consensus that the article doesn’t provide a valid solution for the problem it says it solves (making sure that globally installed packages are readable and executable by all users on the machine), we can decide on a proper solution and open a PR to fix the documentation.