安装VUE

1.下载并安装Nodejs ,从官网下载LTS版(https://nodejs.org/en/

  检查是否安装完成,安装Nodejs同时会安装npm

node -v

npm -v

2.以npm方式全局安装Vue-cli(npm install --global vue-cli)

npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
C:\Users\wanglifu\AppData\Roaming\npm\vue-list -> C:\Users\wanglifu\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list
C:\Users\wanglifu\AppData\Roaming\npm\vue-init -> C:\Users\wanglifu\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
C:\Users\wanglifu\AppData\Roaming\npm\vue -> C:\Users\wanglifu\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
+ vue-cli@2.9.6
added 241 packages from 205 contributors in 92.102s

3.vue项目初始化命令如下,若没有安装webpack,则先安装webpack

npm install -g webpack

vue init webpack myVue

注:安装过程 中有个选项(Use ESLint to line your code ?选择 No )

 

坑:如果你想安装3.X,则应如下操作

卸载2.X:

npm uninstall -g vue-cli 或 yarn global remove vue-cli

安装3.X:
npm install -g @vue/cli 或 yarn global add @vue/cli

4、进入到myVue目录下,使用npm install 安装package.json包中的依赖

命令如下:

cd myVue

npm install

5、运行项目:

npm run dev

在浏览器上输入:localhost:8080,将会出现下面的vue初始页面:

6、Ctrl+C,Y退出

 

注:

由于安装了vue cli 3.x版本无法使用init指令,可使用安装init指令模块:

npm install -g @vue/cli-init
posted @ 2020-03-31 12:01  flycatony  阅读(2927)  评论(0编辑  收藏  举报