访问 https://nodejs.org/en/ ,下载并安装LTS版本
Windows建议安装在 C:\nodejs目录
查看node安装版本,验证是否安装成功
node -v
npm config set registry https://registry.npm.taobao.org --global
npm install -g vue-cli
npm install -g @vue/cli
npm i -g @vue/cli-init
npm install -g webpack
d: && cd d:\projects
vue init webpack vuedemo
? Project name vuedemo
? Project description A Vue.js project
? Author Ken <m@ken.io>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm
vue-cli · Generated "vuedemo".
# Installing project dependencies ...
# ========================
通过Vue CLI初始化项目
d: && cd d:\projects
vue create vuedemo
Vue-Cli提供了三个选项,这里我们选择第2个即可
Vue CLI v4.5.13
? Please pick a preset: (Use arrow keys)
Default ([Vue 2] babel, eslint)
> Default (Vue 3) ([Vue 3] babel, eslint)
Manually select features
cd vuedemo
npm install
#vue 2.x
npm run dev
#vue 3.x
npm run serve
解决办法:配置环境变量PATH,增加:C:\Program Files\nodejs
permissions of the file and its containing directories, or try running, the command again as root/Administrator.
解决办法:使用sudo命令