Installing Nuxt.js and previewing the default project
To serve different routes, in the background Nuxt.js uses Vue-router. To keep things simple, we'll focus on using Nuxt.js.
There are a few ways to get started with Nuxt.js. One option is via the vue init
command. Another one is with a practice that is common, which is the create-nuxt-app
command, similar to create-elm-app
or create-react-app
.
Installing Nuxt.js with the vue init command
Let's begin by finding a location on our drive to save our new Nuxt app, and then use the vue init
command to create it:
vue init nuxt-community/stater-template chapter8
Running this command without vue init
being installed might return the following message in the console:
Command vue init requires a global addon to be installed. Please run yarn global add @vue/cli-init and try again.
Hence, to rectify the issue, simply run this:
yarn global add @vue/cli-init
This will take some time, but ultimately we'll end up being able to run the vue init
command:
vue init...