npm install -g nrm
nrm ls
* npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npm.taobao.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
nrm use taobao
npm常见命令
mac安装为(sudo npm …)
sudo npm install @vue/cli -g
或者授权这个文件夹,以后就不用sudo了:
sudo chown -R $USER /usr/local
npm list -g --depth 0 //查看安装的全局包
npm get registry --显示当前的镜像网址
npm config set registry http://registry.npm.taobao.org – 使用淘宝的镜像网址
npm config set registry https://registry.npmjs.org // 源地址
npm --registry=https://registry.npm.taobao.org i
npm install -g cnpm --registry=https://registry.npm.taobao.org
//安装cnpm,淘宝镜像,为了提高npm使用效率
npm i @vue/cli -g
//全局安装vue-cli最新版本
vue create hello-world
//创建hello-world项目
vue ui
//可视化编辑
npm init -y //初始化package.json文件,默认yes
删除vue-cli方法:
mac电脑到这里直接删除文件夹
/usr/local/lib/node_modules/vue-cli/node_modules
// 测试单个组件文件
npm install -g @vue/cli-service-global
vue serve 组件名.vue