vue-cli
Vue-cli是基于Vue的工具。用于提高开发效率。我这里主要是用于搭建环境。
安装
docker配置
docker compose文件
version: '3'
services:
node:
image: "node"
command: ["/bin/bash"]
stdin_open: true
tty: true
volumes:
- f:/git_project:/usr/share/nginx/html
安装cnpm(国内用npm会比较慢,所以可以使用cnpm加速)
npm cache clean -f
npm install -g n
n stable
npm install
# 我直接执行这个报错了(cb() Never called),所以需要执行下上面的命令
npm install -g cnpm --registry=https://registry.npm.taobao.org
安装webpack,vue,vue-cli
cnpm install -g @vue/cli
创建vue项目
vue create hello-world
启动
安装 webpack-cli,webpack-dev-server
启动的时候报了 Cannot find module 'webpack-dev-server/client' 错误,先安装下缺失的包
cnpm install --save-dev webpack-dev-server