Create a new project manually

Create a new project directory in the specified directory

mkdir my-project 
cd my-project

Package.json created in the current directory (my-project), reads as follows:

{
  "name": "my-project",
  "scripts": {
    "dev": "nuxt"
  }
}

The above configuration allows us to run nuxt by running npm run dev.

After creating package.json, installation nuxt in the project:

npm install --save nuxt

Creating pages directory (Nuxt.js will generate routing application based on all * .vue pages directory configuration files):

 mkdir pages

Create a page in the pages directory (index.vue):

<template>
  <h1>Hello world!</h1>
</template>

After creating the project started:

npm run dev

After starting the compiler wait, then by http: 3000 Run: // localhost.

Nuxt.js listens  pages file directory changes, there is no need to restart the application when adding a new page.

Reference: https: //zh.nuxtjs.org/guide/installation#%E4%BB%8E%E5%A4%B4%E5%BC%80%E5%A7%8B%E6%96%B0%E5%BB % BA% E9% A1% B9% E7% 9B% AE

Guess you like

Origin www.cnblogs.com/gme5/p/11763771.html