npm yarn的使用
删除会恢复默认镜像
npm config delete registry
查看当前镜像
npm get registry
设置淘宝镜像
yarn config set registry https://registry.npm.taobao.org/
npm config set registry https://registry.npm.taobao.org/
设置官方镜像
npm config set registry https://registry.npmjs.org/
yarn config set registry https://registry.npmjs.org/
npm安装依赖
【npm install】安装项目的全部依赖
【npm install --production】安装项目的生产环境依赖
【npm install xxx】利用 npm 安装xxx依赖到当前命令行所在目录
【npm install xxx -g】利用npm安装全局依赖xxx
【npm install xxx –save】 安装并写入package.json的”dependencies”中
【npm install xxx –S】 安装并写入package.json的”dependencies”中
【npm install xxx –save-dev】安装并写入package.json的” devDependencies”中
【npm install xxx –D】安装并写入package.json的”devDependencies”中
npm删除依赖
【npm uninstall xxx】删除xxx依赖
【npm uninstall xxx -g】删除全局依赖xxx
删除本地模块时你应该思考的问题:是否将在package.json上的相应依赖信息也消除?
npm uninstall 模块:删除模块,但不删除模块留在package.json中的对应信息
npm uninstall 模块 --save 删除模块,同时删除模块留在package.json中dependencies下的对应信息
npm uninstall 模块 --save-dev 删除模块,同时删除模块留在package.json中devDependencies下的对应信息