LoginSignup
5
5

More than 5 years have passed since last update.

とりあえずローカルに Ghost をインストール (Ghost-CLI 版)

Posted at

Ghost-CLI を用いてローカルに Node.js 製の CMS である Ghost をインストールするまとめです。

参考「Overview」(Ghost のドキュメント)

1. Node のバージョン

2018/04/23 現在、Ghost の Node の推奨バージョンが 6.9 のようなので、6.9 にします。
(頑張れば、最新バージョンの Node でも動くかもしれませんが、何か不具合が出ると嫌なのでおとなしくバージョンを変更します)

自分の場合は n を使っていたので、すんなりできました。
nvm の場合は注意が必要そう…?

n の場合
sudo n 6.9

参考「Supported Node Versions」(Ghost)
参考「Using nvm - Troubleshooting」(Ghost)
参考「GitHub - tj/n: Node version management」(n)

2. Ghost インストール

作業したいディレクトリ内で、

npm init -y
npm i -D ghost-cli # ローカルで使用するだけと仮定して、おそらく -D で良いと思います

mkdir ghost
cd ghost

npx ghost install local # ローカルなので local
npx ghost stop # install が成功すると自動で start されるので、止めたいときは stop

自分がやったときは、install 中に通信エラーが発生して一度止まってしまったのですが、再度 npx ghost install local したら上手く行きました (再インストール時は ghost install しようとしているフォルダを空にする必要あり) 。

ローカルの場合は、特に config をいじらなくても良さそう。

(普通は -g で ghost-cli をグローバルインストールするのでしょうが、今回は「とりあえず」ということもあって、グローバルにせずやってみました)

参考「Install (local / dev)」(Ghost)

3. Ghost 動かす

npx ghost start

あとはブラウザで色々。

  • http://localhost:2368/
  • http://localhost:2368/ghost (管理画面)
5
5
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
5
5