Ghost does not start after 'ghost install local'

HELP! I cannot make Ghost work after ghost install local.
I have reinstalled nvm, nodejs, npm, the chalk module etc. and reconfigured everything if I missed something, but still cannot figure out the solution.
(A had an older version of Ghost working on the same system, I just gave it another try and restarted with installing the current version.)

after ghost start I got:

Running in development mode

✔ Checking system Node.js version - found v18.18.2
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Validating config
✔ Checking memory availability
✔ Checking binary dependencies
✖ Starting Ghost: ghost-local
A GhostError occurred.

Message: 
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module 'chalk'
Require stack:
- /home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/lib/styles.js
- /home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/lib/pretty-cli.js
- /home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/index.js
- /home/path/to/my/ghost/project/versions/5.72.1/core/cli/command.js
- /home/path/to/my/ghost/project/versions/5.72.1/ghost.js
- /home/path/to/my/ghost/project/versions/5.72.1/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/lib/styles.js:1:15)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/lib/styles.js',
    '/home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/lib/pretty-cli.js',
    '/home/path/to/my/ghost/project/versions/5.72.1/node_modules/@tryghost/pretty-cli/index.js',
    '/home/path/to/my/ghost/project/versions/5.72.1/core/cli/command.js',
    '/home/path/to/my/ghost/project/versions/5.72.1/ghost.js',
    '/home/path/to/my/ghost/project/versions/5.72.1/index.js'
  ]
}

Node.js v18.18.2


Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost Version: 5.72.1
    Ghost-CLI Version: 1.25.3
    Environment: development
    Command: 'ghost start'

Additional log info available in: /home/aaao/.ghost/logs/ghost-cli-debug-2023-11-08T18_01_50_131Z.log

Try running ghost doctor to check your system for known issues.
.```

BTW, I read on https://ghost.org/docs/install/local/ that  
* The SQLite3 database is auto-setup and located in `/content/data/`
but the folder is empty.

Have you attempted to install this dependency, e.g., npm install chalk?

Yes, but after npm install chalk I got the same error.

Without knowing how your system is set up, it’s difficult to diagnose the issue. However, you might have installed Node twice. Since you’re using Ubuntu, I’d avoid nvm and install from the official Node repository using APT.

curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash
sudo apt install nodejs --yes
sudo npm install ghost-cli@latest -g

You can also see what you have installed with …

npm list -g --depth=1

I have also tried with the official Node repo using apt, the same error occured.

Using APT and nvm at the same time may have caused the issue. I’d remove Node completely, and then reinstall, using APT and the official repository. This method has never let me down, and upgrading Node versions is a breeze (as required by recent updates to Ghost.)

I deleted nvm and all nodejs versions and reinstalled Node with apt, so now:

nodejs -v
v18.18.2

npm -v
9.8.1

After sudo npm install ghost-cli@latest -g or npm i ghost-cli
ghost --version
Ghost-CLI version: 1.23.0
(but isn’t the latest version is 1.25.3?)

Then after
ghost install local
I got the following error:

You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.


✖ Checking system Node.js version - found v18.18.2
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
One or more errors occurred.

1) Checking system Node.js version

Message: The version of Node.js you are using is not supported.
Supported: ^12.22.1 || ^14.17.0 || ^16.13.0
Installed: 18.18.2
See https://ghost.org/docs/faq/node-versions/ for more information

Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost-CLI Version: 1.23.0
    Environment: development
    Command: 'ghost install local'

Despite, as I am reading on Supported node versions for self-hosted installs of Ghost :

Ghost’s current recommended Node version is Node v18 LTS.
Version	Support Level
17.x and below	Unsupported
18.x (Node v18 Hydrogen LTS)	Recommended
19.x and above	Unsupported

So, on Ubuntu, run sudo npm install -g ghost-cli@latest.

After
sudo npm install -g ghost-cli@latest
the same ghost-cli version:
Ghost-CLI Version: 1.23.0

and the same error after ghost install local

I suspect your environment needs some tidying up to remove all traces of Node. Indeed, I just did a local installation on Ubuntu 23.10 and it worked fine.

Install prerequisites including Node

sudo apt update
sudo apt install --yes ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt update
sudo apt install --yes nodejs

Install Ghost-CLI

sudo npm install -g ghost-cli@latest
# Advised that newer version of npm available
sudo npm install -g npm@10.2.3

Install Ghost

mkdir -p ~/ghost/test
cd ~/ghost/test
ghost install local

Yes, the latest is 1.25.3. You could try ghost buster.

Ok, I will clean my os again and hope the best, thanks!

1 Like

Hi again… and thanks!
I upgraded Ubuntu to 23.04 first, which did not solve the problem (of messed up node versions and packages), but
after I reinstalled Ubuntu 22.04, the official instructions you advised for installing Ghost worked. Thanks again! :green_heart:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.