Create new vue project
Here are the steps to create a new Vue.js project:
Method 1: Using Vue CLI
-
Install Vue CLI globally by running the following command:
npm install -g @vue/cli
-
Create a new project by running the following command:
vue create my-vue-app
Replace
my-vue-app
with the name of your project. -
Follow the prompts to choose the project template and configuration options.
Method 2: Using Vue CLI with a specific template
- Install Vue CLI globally by running the following command:
npm install -g @vue/cli
- Create a new project with a specific template by running the following command:
vue create my-vue-app --template webpack-simple
Replace
my-vue-app
with the name of your project andwebpack-simple
with the template name.
Method 3: Using npm init and installing Vue.js manually
- Create a new directory for your project and navigate into it:
mkdir my-vue-app cd my-vue-app
- Initialize a new npm project by running the following command:
npm init
- Install Vue.js and other dependencies by running the following command:
npm install vue
- Create a new file called
main.js
and add the following code:import Vue from 'vue' import App from './App.vue'
Vue.createApp(App).mount('#app')
5. Create a new file called `App.vue` and add the following code:
Hello World!
That's it! You now have a new Vue.js project up and running.