LoginSignup
1
1

More than 3 years have passed since last update.

UnuboでNuxt.jsを動かす!

Last updated at Posted at 2020-01-11

Unuboとは?

皆さんはUnuboというサービスを知っていますか?
Go, Node.js, Pythonなどのアプリケーションを無料でデプロイできるサービスです。
DBも、MariaDB, PostgreSQL, Redisの3種類が無料で使えます。

Nuxt.jsを動かす方法は公式ドキュメントgithubを見てもなかったため、実際に動かすまでをまとめたいと思います。

GithubにNuxt.jsのプロジェクトをpushしている事が前提です。

実践

  1. Unuboにログインし、Node.jsのプロジェクトを作成します。
    Screen Shot 2020-01-11 at 15.23.38.png

  2. RepositoryからデプロイしたいNuxt.jsのプロジェクトを選択します。

  3. Commandsに下記の3つを登録します。

yarn
yarn build
yarn start
  1. SecretsにHOST=0.0.0.0を登録します。 Screen Shot 2020-01-11 at 15.29.04.png

最後にDeployを押して数分待てば無事公開されます!

ログが見辛すぎて1週間以上かかってしまった。。

追記:
ts-nodeは動かないっぽいです。
下記のエラーが延々と出続ける。。

error Command failed with signal "SIGKILL".

yarn startnpm run startを使わずに、直接ts-nodeを使うことでいけました!

node_modules/.bin/ts-node server/index.ts
# or
node -r ts-node/register server/index.ts

Express + TypeScriptのシンプルな構成だとこのやり方で行けたんですが、Nuxt.jsを使ってると動かないようです。
Runtime(オプション)辺りを弄る必要があるのかも。。
当面はbabelでトランスパイルすることで回避したいと思います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1