In this tutorial, we are going to look at how you can setup your development environment so that you can get started writing your own VueJS.

We will be utilizing the vue-cli in order to start our project off and then we’ll be diving in and making a few edits, before finally building it using the same vue-cli.

Video Tutorial

A Simple Vue App

Before I get started, it must be noted that you can get up and running really quickly with VueJS 2 in less than 30 lines of code. Below you will find a webpage that is a very simple VueJS page that simply prints out Hello World to the browser when hit.

<!DOCTYPE html>
<html lang="en">
    <title>VueJS Starter</title>
    <div id="app">
        {{ message }}
    <script src=""></script>
    new Vue({
        el: '#app',
        data() {
            return {
                message: 'Hello World'
        created() {
            console.log("Hello World")

It should be noted though that if you want to create more advanced VueJS applications then using the vue-cli going forward is recommended!

Getting Started with the CLI

In order to get started, we’ll first have to install the vue-cli. This can be done using npm:

$ npm install -g vue-cli

Once this has successfully run, you should now be able to run vue and it should return the following:

$ vue

  Usage: vue <command> [options]


    -V, --version  output the version number
    -h, --help     output usage information


    init        generate a new project from a template
    list        list available official templates
    build       prototype a new project
    help [cmd]  display help for [cmd]

Now that we have successfully verified our installation, we can begin our journey into creating VueJS based applications.

Creating Your First Application

In order to generate our first project, navigate to a new project directory and then run the vue init webpack command.

$ vue init webpack

? Generate project in current directory? Yes
? Project name starter-project
? Project description a simple starter project
? Author Elliot Forbes
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm

   vue-cli · Generated "vuejs".

# Installing project dependencies ...
# ========================
... (omitted for brevity)

Running Your Application Locally

Once you’ve successfully initiated your basic Vuejs project, it’s time to run it locally and see it all working. You can do that by running the following command:

$ npm run dev

> [email protected] dev /Users/elliot/Documents/Projects/tutorials/vuejs
> webpack-dev-server --inline --progress --config build/

 95% emitting

 DONE  Compiled successfully in 3736ms                                                                                                                                                                                          22:05:21

 I  Your application is running here: http://localhost:8080

This will run a development server on http://localhost:8080 and you will be able to navigate to this in your browser. You should hopefully see a fully function Vuejs application running within your browser.

Now that you have your application up and running, you are free to explore the directories and the files generated by the vue cli. We shall be demystifying what they all mean in tutorials to come.

Building Your Application

Once you are happy with your application and want to deploy it to the likes of an AWS S3 bucket or to your production server, you will first have to build it by running this command:

$ npm run build

This will then create a dist/ directory within your application’s root directory. This dist/ directory contains everything your application needs in order to run. You can then simply drop the files within this directory to your server or S3 bucket and it will be ready to go!

Minor Changes To Get Started

Now that we have our basic VueJS application up and running, it’s time to make some simple edits to it just to get us started. Open up the src/components/HelloWorld.vue component and remove some of the default HTML code from the <template/> section like so:

  <div class="hello">
    <h1>{{ msg }}</h1>
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
ul {
  list-style-type: none;
  padding: 0;
li {
  display: inline-block;
  margin: 0 10px;
a {
  color: #42b983;

When you click save and have npm run dev running within the console, you should notice that it starts to rebuild everything for you. When you refresh http://localhost:8080 you should see your changes reflected within the browser.

Congratulations, you have successfully built and subsequently edited your first VueJS application!

Further Reading

Now that you have a simple VueJS application up and running on your local machine, it’s time to try and figure out what everything means. We have made a few changes already but in order to learn more I would recommend having a look at my article on VueJS Components.


Hopefully, you found this tutorial helpful in getting started with Vuejs 2! If you did, or you require further assistance, then please let me know in the comments section below.