1、下载node.js,地址:http://nodejs.cn,安装完成后在cmd中查看是否已安装成功:node -v
2、安装淘宝npm镜像:npm install -g cnpm --registry=https://registry.npm.taobao.org,安装过程中如果发生如下警告信息
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
C:UsersAdministratorAppDataRoaming
pmcnpm -> C:UsersAdministratorAppDataRoaming
pm
ode_modulescnpmincnpm
+ cnpm@6.0.0
added 679 packages from 898 contributors in 38.097s
可以尝试如下操作:
cnpm install cnpm@6.0.0
使用cnpm -v 命令查看一下是否安装成功,如下图:
3、下面安装vue-cli脚手架,输入命令:cnpm install --global vue-cli 回车;验证是否安装成功,在命令输入vue,出来vue的信息,及说明安装成功;
4、利用脚手架创建vue开发项目包
vue init webpack myProjec
如果创建项目时一直处于downloading template状态处理,可是之前安装webpack的问题,可以尝试:npm install webpack -g重新安装一下试一下。
5、完成安装后运行cnpm run dev即可
注:如果有类似如下警告信息,可以按照提示进行安装:
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modulesfsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
进行项目目录后运行:
npm install -g npm-install-peers
npm install -g npm
npm i ajv