Skip to content

AshleyCao/nuxt-typescript-pm2

Repository files navigation

Nuxt.js TS PM2

Nuxt.js with ts and pm2

Introduction

Nuxt.js 2.4.0 has released, checkout this announcement. Finally, typescript set up is easy and handy. So basically, you just need to install nuxt-ts and ta-da!!!

As for PM2, it is a project process manager for Node.js application. And I find it helps cutting off all setting-up bash files if you want to run you app on linux server all the time.

In this project, it includes all two common UI plugins(bootstrap-vue and element-ui), js-cookies and vuelidate etc. If those are all suitable for your project, just simply delete node_modules folder and run yarn install.

Some issues and heads-up

  • Bootstrap I used to include bootstrap in modules in nuxt.config file. Now it seems there are some problems when it loads. So include bootstrap in plugins in nuxt.config. Ref
  • $loding ( var override) Ref, @P-de-jong's comment works for me. Turn off lib check in tsconfig
  • About linux It only happened to me at first time when I added plugin via yarn on linux server . Just in case it may occur to you. Error: There appears to be trouble with your network connection. Retrying... Ref,
yarn config set proxy [http://username:password@host:port](http://username:password@host:port/)  
yarn config set https-proxy [http://username:password@host:port](http://username:password@host:port/)

Set npm timeout didnot work for me

Build Setup

Please follow package.json, tsconfig.json and nuxt.config.ts files to check my set up.

# install dependencies
$ yarn install

# serve with hot reload at localhost:3000
$ yarn run dev

# build for production and launch server
$ yarn run build
$ yarn start

# generate static project
$ yarn run generate

For detailed explanation on how things work, checkout Nuxt.js docs.

About

Nuxt.js example with typescript and PM2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published