Modify the cache address of npm (under the C drive by default):
// 先在指定位置建好目录
npm config set prefix "D:\nodejs\node_global"
npm config set cache "D:\nodejs\node_cache"
Install Taobao Mirror (cnpm):
npm install -g cnpm --registry=https://registry.npm.taobao.org
Or directly configure the npm source as the Taobao mirror. After modification, each npm xxx is actually a plug-in from the Taobao mirror:
npm config set registry https://registry.npm.taobao.org
// 可用下面方式来检查是否成功
npm config get registry
Install vue-cli globally:
npm install -g @vue/cli
// 检查是否成功
vue --version
Install vue-router globally:
npm install vue-router -g
Install webpack:
// webpack4以后webpack和webpack-cli分开,-g全局安装
npm install webpack webpack-cli -g
// 局部-D安装依赖
npm install webpack webpack-cli -D
Other dependencies of webpack:
// 本机起服务
npm install --D webpack-dev-server
// 配置合并
npm install --D webpack-merge
Install babel:
npm i babel-loader @babel/core @babel/preset-env -D
React also needs:
npm i @babel/preset-react -D
install vite
npm create vite@latest my-vue-app --template vue
npm create vite@latest my-vue-app --template vue-ts
cd projectName //进入工程项目文件夹
npm install //安装项目依赖
npm run dev //运行项目
install nuxt
vue init nuxt-community/starter-template projectName