NPM INSTALL-G Global Installation always has a solution for permission permissions issues
When you start using node, when you use NPM to install global packages, you habitually use npm install-g xxx, and then always prompt for permissions issues and installation fails.
Need to use sudo. The question really makes me wohuo. There is no need for a package to be put into a/usr/local/directory that requires special permissions, so try to solve it.
Here's a solution to put NPM's global package installation path into the current user's home directory, avoiding Sudo, as well as installing the Global NPM package:
#brewInstallnode #mac os Xmkdir "${home}/.npm-packages"Echonpm_packages="${home}/.npm-packages">> ${home}/. BASHRCEchoPrefix=${home}/.npm-packages >> ${home}/. NPMRCEchoNode_path=\"\ $NPM _packages/lib/node_modules:\ $NODE _path\ ">> ${HOME}/.BASHRCEchoPath=\"\ $NPM _packages/bin:\ $PATH \ ">> ${HOME}/.BASHRC# will: Source~/.BASHRC Write to ~/At the end of the. bash_profile file, then, if you want to use it now, you also need to run the following command. SOURCE~/.bashrc
Reference Links:
1.
NPM INSTALL-G Global Installation always has a solution for permission permissions issues