新版vue脚手架安装

mac和windows都适用,mac需要sudo,win不需要

先安装这个(无脑安装,一直点下一个)
http://nodejs.cn/download/
查看版本

node -v  

2.安装Vue

说明:vue依托nodejs,vue只是node万千包中的一个。
1.先查看电脑里有没有安装vue: 命令:vue -V //注意V大写,
若提示 command not found 则进行下一步;
若提示版本号为:2.9.6 ,则需要卸载这一版本

2.新版vue脚手架安装命令(mac)sudo npm install -g @vue/cli
win系统命令(必须要在管理员权限下安装)install -g @vue/cli
前面加sudo 是获取系统的权限,之后需要输入密码,不加sudo可能因为权限的问题安装失败。

vue -V 显示安装版本,则安装成功

卸载旧版vue

npm uninstall -g vue-cli

下载脚手架(mac)

sudo npm install -g @vue/cli

下载脚手架(win)

 npm install -g @vue/cli

查看版本

vue -V

创建项目命令

vue create hello-world

运行项目

npm run serve

使用webpack搭建项目失败 使用npm报错

mac:Vue newer$ npm install -g @vue/cli-init
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@vue/cli-init
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli-init'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli-init'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/@vue/cli-init'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/newer/.npm/_logs/2022-04-11T13_36_40_471Z-debug-0.log

使用 sudo npm install -g @vue/cli-init



Command vue init requires a global addon to be installed.
  Please run npm i -g @vue/cli-init and try again.

mac:Vue newer$ sudo npm install -g @vue/cli-init
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值