Vue 3 Installation
1. Standalone Version
We can download the latest version directly from the Vue.js website and use Import via tag.
2. Using the CDN method
The following recommends two relatively stable foreign CDNs; no good domestic one has been found yet, so it is still recommended to download locally.
-
cdnjs : https://cdnjs.cloudflare.com/ajax/libs/vue/3.0.5/vue.global.js
-
Staticfile CDN (China) : https://cdn.staticfile.net/vue/3.0.5/vue.global.js
-
unpkg:https://unpkg.com/vue@3/dist/vue.global.js, will stay consistent with the latest version published on npm.
Staticfile CDN (China)
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
ByteDance CDN (China)
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
unpkg (unstable in China)
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
cdnjs
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
We can use the ES module build to create a more modern and modular development environment:
Example
{{ message }}
Try it »
3. NPM Method
Because npm installation is slow, this tutorial uses Taobao's mirror and its cnpm command; for installation instructions, refer to:Using the Taobao NPM Mirror.
The npm version needs to be greater than 3.0; if it is lower, you need to upgrade it:
# Check version
$ npm -v
2.3.0
#升级 npm
cnpm install npm -g
# Upgrade or install cnpm
npm install cnpm -g
When building large applications with Vue.js, it is recommended to use cnpm for installation; cnpm works well with module bundlers like Webpack or Browserify. Then run the following command in the command line:
# Latest stable version
$ npm init vue@latest
This command installs and runs create-vue, which is Vue's official project scaffolding tool.
$ npm init vue@latest
Need to install the following packages:
create-vue@3.6.1
Ok to proceed? (y) y
Vue.js - The Progressive JavaScript Framework
# Some configuration needs to be done here, enter the project name runoob-vue3-test, and press enter for others
-> Project name: … runoob-vue3-test
-> Add TypeScript? … No / Yes
-> Add JSX Support? … No / Yes
-> Add Vue Router for Single Page Application development? … No / Yes
-> Add Pinia for state management? … No / Yes
-> Add Vitest for Unit Testing? … No / Yes
-> Add an End-to-End Testing Solution? › No
-> Add ESLint for code quality? … No / Yes
Scaffolding project in /Users/runoob/runoob-test/runoob-vue3/runoob-vue3-test...
Done. Now run:
cd runoob-vue3-test
npm install
npm run dev
If you are unsure whether to enable a feature, you can simply press Enter to select No.
After the project is created, install dependencies and start the dev server with the following steps:
$ cd runoob-vue3-test
$ npm install
$ npm run dev
VITE v4.3.4 ready in 543 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
After successfully running the above commands, visit http://localhost:5173/, and the output is shown below:

Note:Vue.js does not support IE8 and earlier IE versions.
Using the Graphical Interface
We can open the graphical interface to create and manage projects via the vue ui command:
vue ui
Running the above command opens a graphical interface in the browser to guide project creation:

Vite
Vite is a web development build tool that achieves lightning-fast cold server startup thanks to its native ES module import approach.
By running the following command in the terminal, you can quickly scaffold a Vue project with Vite. The syntax is as follows:
npm init vite-app
Create the project runoob-vue3-test2:
$ npm init vite-app runoob-vue3-test2
Run the project:
$ cd runoob-vue3-test2
$ cnpm install
$ cnpm run dev
> runoob-vue3-test2@0.0.0 dev /Users/runoob/runoob-test/vue3/runoob-vue3-test2
> vite
[vite] Optimizable dependencies detected:
vue
Dev server running at:
> Local: http://localhost:3000/
Open http://localhost:3000/, and the display is as follows:
