npm使用

2017-01-09  本文已影响0人  issac_宝华
npm init
//mac安装要在前头加sudo,在sudo模式下运行
npm [-g] install <包名>[@版本号] [--save-dev]
//-g: 全局安装
//--save-dev:将包名保存到packjson.json文件中
npm list -g --depth 0
//全局安装的包放在:/usr/local/lib/node_modules 下(mac)
//mac安装要在前头加sudo,在sudo模式下运行
npm install
npm uninstall <包名>

//mac安装要在前头加sudo,在sudo模式下运行

npm update <包名>
npm list
//mac安装要在前头加sudo,在sudo模式下运行
npm config get registry
//默认镜像源是国外网站,没有翻墙,下载npm包会很慢,甚至下不了
//可以将镜像源设为淘宝的镜像源:npm --registry https://registry.npm.taobao.org install express
//
//临时使用
//mac安装要在前头加sudo,在sudo模式下运行
npm --registry https://registry.npm.taobao.org install <包名>
//长久使用淘宝镜像
npm config set registry https://registry.npm.taobao.org
npm root [-g]
上一篇 下一篇

猜你喜欢

热点阅读