什么是Nuxt.js?
Nuxt.js 是基于Vue.js的框架,允许您构建成熟的服务器呈现应用程序。
- npx 创建
npx create-nuxt-app my-first-nuxtjs
> Generating Nuxt.js project in /Users/popgis/projects/my-first-nuxtjs
? Project name my-first-nuxtjs
? Project description A Nuxt.js application for test.
? Use a custom server framework express
? Use a custom UI framework element-ui
? Choose rendering mode Universal
? Use axios module yes
? Use eslint yes
? Use prettier yes
? Author name popgis
? Choose a package manager npm
Initialized empty Git repository in /Users/popgis/projects/my-first-nuxtjs /.git/
> fsevents@1.2.4 install /Users/popgis/projects/my-first-nuxtjs /node_modules/fsevents
> node install
[fsevents] Success: " /Users/popgis/projects/my-first-nuxtjs /node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> nodemon@1.18.5 postinstall /Users/popgis/projects/my-first-nuxtjs /node_modules/nodemon
> node bin/postinstall || exit 0
> nuxt@2.2.0 postinstall /Users/popgis/projects/my-first-nuxtjs /node_modules/nuxt
> opencollective || exit 0
:=.
-=+=: :-
.-=+++=: :++=.
.-+++++++=++++=.
.=+++++++****++++.
:=+++++++******++*+:
:=+++++++********++*+:
:=+++++++**********++*+-
-=+++++++*************+*+-.
.-=======+**************++++=.
.........::::::::::::::::::::.
Thanks for installing nuxtjs
Please consider donating to our open collective
to help us maintain this package.
Number of contributors: 152
Number of backers: 127
Annual budget: US$30,663
Current balance: US$5,806
Donate: opencollective.com/nuxtjs/donate
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN eslint-plugin-vue@4.7.1 requires a peer of eslint@^3.18.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN acorn-jsx@5.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
added 1111 packages from 543 contributors and audited 14617 packages in 59.616s
found 0 vulnerabilities
To get started:
cd my-first-nuxtjs
npm run dev
To build & start for production:
cd my-first-nuxtjs
npm run build
npm start
- yarn 创建
yarn create nuxt-app my-first-nuxtjs
2.1 提示信息
这将提示您回答一些问题,包括:
- 在集成服务器端框架之间进行选择(默认情况下无,Express、Koa 等)
- 选择要安装的功能(PWA 支持、点/物、普雷蒂埃、Axios)
- 选择您最喜爱的 UI 框架(默认情况下无,引导、维化、Bulma 等)
- 选择您最喜爱的测试框架(无、Jest、AVA)
- 您想要的 Nuxt 模式(通用或 SPA,更多信息))
2.2 完成后,您的依赖项将安装:
$ cd <project-name>
$ yarn dev