前端开发，避免不了安装npm 有时候依赖的包，升级了，自己用的版本老了，怎么办，肯定是升级，下面就说说如何查找 可以升级的包，怎么升级的。
npm -g outdated
npm update <name> -g //<name> 是你要升级的包
npm update tern -g
npm-check -u -g // 全局
npm-check -u //当前项目 目录
然后 使用 空格键 和 Enter键 操作 升级
checkPermissions Missing write access to /usr/local/lib/node_modules/typescript
bogon:~ smile$ npm update typescript -g
sudo chown -R $USER /usr/local/lib/node_modules
The first time you try to install a package globally using npm, using the syntax
npm install -gon a Mac, or Linux, you might get a weird error, saying something like
1 Missing write access to /usr/local/lib/node_modules
or something along those lines, followed by a long list of other errors of warnings, a consequence of the first error that’s printed to you.
This error is preventing us to install the package.
How do you fix this? It’s a permission error, which means you don’t have write access to that folder.
This is how to solve it. Run this command:
1 sudo chown -R $USER /usr/local/lib/node_modules
Let’s break it down:
sudomeans we are running this command as
root, the system super user. This is because we don’t have permission to write to that folder, but
rootwill be able to fix any permission. This command also means the system will ask for your password to confirm.
chownis the command we use to change the owner of a file or folder. We set the
-Roption to change the owner recursively, so we also get owner access to all the files already contained in there.
$USERis an environment variable automatically set to your username.
And the final piece is the folder path.
Running this path will make the folder yours, so you can safely run your
npm install -gcommands!
Pay attention to the folder listed by the error message. If it’s different, update the