How to install Ghost Blog v5.x+ for Theme Development

Getting Started

Theme development requires two steps:

  1. Install Ghost Blog on your local computer.
  2. Configure your developer environment.

Step 0 - Install Node Version Manager

Read this article on how to install multiple versions of node using Node Version Manager.

Step 1 - Install Node

Install the right version of Node to work with Ghost.

nvm install 16.19.1

Set the node version to be the default.

nvm alias default 16.19.1

Step 2 - Install Ghost + Cli

Install Ghost framework globally (-g).

npm install ghost-cli@latest -g

Create a new directory to download the Ghost tools

cd ~/Desktop
mkdir GHOST_BLOG
cd ~/Desktop/GHOST_BLOG

Install Ghost on your local machine.

ghost install local

Step 3 - Start Ghost

ghost start

Traditionally, Ghost wants you to work on the theme within Ghost/content/themes but your GIT repo may live somewhere else. So the solution is to create a SymLink.

Change directory into the /themes folder of your Ghost installation.

cd /path/to/ghost/content/themes

Create a SymLink

ln -s /path/to/git/repo/website/development/my_folder

Start Development

cd /path/to/git/repo/website/development/my_folder

Dev will run a gulp command. Gulp uses an NPM tool called BrowserSync to construct a wrapper around Ghost. This allows you to make changes to a file within the theme, and the Ghost website will update automatically.

npm dev

Resources

Resetting Your Password

I've locked myself a few times while in development mode and one solution is to simply update your SQLLite file with a new password. I use this online Password Hashing Algorithm to help create something quick and easy.

Too Many Login Attempts Error

If you fail too many times while trying to log in, you will get locked out. Fixing it will require you to open config.development.json and modify these JSON configurations.

You do not need to modify all of these. I am including them so that everything is kept nicely together. The only two nodes you'll want to review are user_login and global_block.

{
	"spam": {
	    "user_login": {
	        "minWait": 300,
	        "maxWait": 300,
	        "freeRetries": 100000000
	    },
	    "user_reset": {
	        "minWait": 300,
	        "maxWait": 300,
	        "lifetime": 3600,
	        "freeRetries": 99
	    },
	    "global_reset": {
	        "minWait": 300,
	        "maxWait": 300,
	        "lifetime": 3600,
	        "freeRetries": 99
	    },
	    "global_block": {
	        "minWait": 300,
	        "maxWait": 300,
	        "lifetime": 300,
	        "freeRetries": 100000000
	    },
	    "private_block": {
	        "minWait": 300,
	        "maxWait": 300,
	        "lifetime": 300,
	        "freeRetries": 99
	    }
	}
}

Source