Ghost Theme Development on WSL2

To take advantage of the linux system. developing custom ghost theme with WSL2 on Windows is an ideal option. Yet some incompatible issues is worth recording. Such as detecting file changes.

Ghost Theme Development on WSL2

Start Ghost

sudo npm install -g ghost-cli@latest

ghost install local

ghost start

sqlite3 no found error

Error

ghost/versions/3.41.5/node_modules/knex/lib/client.js:235
      throw new Error(`${message}\n${e.message}`);
      ^

Error: Knex: run
$ npm install sqlite3 --save
Cannot find module 'sqlite3'

Cause and Solution

error on instalation script 5.0.1, install 5.0.0 instead
npm install sqlite3@5.0.0 --save


Link Theme Folder

ln -s /home/my/ghosttheme /home/my/ghost/content/themes/ghosttheme

Live Reload

livereload

Error

"Could not connect to LiveReload server."

Solution

use Browser-Sync as a replacement.

BrowserSync

Potential Issue

"Issue detacting file changes if source files are located in the Host(Windows) File System"

Solution

File shall be located in the file system of WSL2 for BrowserSync to detact file changes correctly