npm市场:www.npmjs.com/
RESTful API www.ruanyifeng.com/blog/2014/0…
npm的下载源是在国外服务器
1、更改下载源
npm get registry 查看镜像地址(下载地址)
如果返回的是https://registry.npmjs.org/ 说明是从国外服务器下载的,速度比较慢
更换镜像地址,更改为淘宝地址
npm config set registry https://registry.npm.taobao.org
下载地址设置为淘宝镜像,从国内下载,速度比较快
npm i xxx npm uninstall xxx
2、使用cnpm
g == global
npm i cnpm -g cnpm i xxx cnpm uninstall xxx
3、使用yarn
npm i yarn -g
npm init yarn init
npm i xxx xxx yarn add xxx xxx
npm uninstall xxx xxx yarn remove xxx xxx
npm i yarn
npm i xxx -g yarn global add xxx
npm i vue@2 yarn add vue@2
npm run start yarn start
4. npm i multiparty
jsonwebtoken
supervisor
yarn add sass sass-loader
npm i xxx 和 npm i xxx --save 会安装到package.json文件里面的dependencies里面
npm i xxx --save-dev 会安装到package.json文件里面的devDependencies里面
npm i xxx -g 全局安装
理论上三种方式都可以,但是建议:
一般情况下不要全局安装,除非是一些常用的 webpack supervisor等等
dependencies 放一些项目中运行的时候需要使用的依赖包 uuid cors mysql
devDependencies dev ==》 development 只有在开发的时候使用,放全局又没啥用的。 eslint
热部署 热启动
supervisor nodemon
全局安装
npm i supervisor -g npm i nodemon -g
supervisor app.js nodemon app.js
npm uninstall vue-cli -g
yarn global remove vue-cli
npm install -g @vue/cli
vue create 项目名