安装全局包
There are two ways to install npm packages: locally or globally. You choose which kind of installation to use based on how you want to use the package.
If you want to use it as a command line tool, something like the grunt CLI, then you can want to install it globally. On the other hand, if you want to depend on the package from your own module using something like Node's require, then you want to install locally.
安装全局包命令 npm install -g <package>
:
npm install -g jshint
如果有访问权限错误, 使用sudo修改权限:
sudo npm install -g jshint