0
点赞
收藏
分享

微信扫一扫

如何安装配置Vue环境

Just_Esme 2022-03-24 阅读 129


安装nodejs

到官网下载安装包,直接安装,会自动配置环境变量 ​​​https://nodejs.org/zh-cn/​​

安装完,node -v,npm -v 查看是否安装成功

如何安装配置Vue环境_其他

npm镜像地址修改成淘宝镜像

npm config set registry https://registry.npm.taobao.org

验证命令

npm config get registry 如果返回https://registry.npm.taobao.org,说明镜像配置成功。

如要更新

npm install -g npm

安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

之后我们就可以使用cnpm代替npm安装依赖包了

cnpm install

全局安装 webpack

npm install webpack -g

全局安装 vue 脚手架

npm install -g @vue/cli-init

初始化 vue 项目

进入项目目录,输入以下命令,然后一路回车

vue init webpack appname

启动项目

进入项目目录

npm run dev

打包项目

npm run build

退出项目

ctrl+d  ctrl+c*

初始化VUE

第一种,引入js

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>

第二种,使用 NPM

npm init -y 
npm install vue

出现下面错误,报缺少Python环境的错,用cnpm解决

Error: Command failed: C:\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3

出现缺少python2.7

第1种情况已安装

检查C盘是否已有Python27,如果有执行如下脚本,设置配置,再执行 npm install

npm config set python C:\Python27

第2种情况未安装

用管理员身份打开cmd

如何安装配置Vue环境_python_02

执行 npm install --global --production windows-build-tools

如何安装配置Vue环境_其他_03

查看可以居于哪些模板创建vue程序

vue list

如何安装配置Vue环境_docker_04



举报

相关推荐

0 条评论