惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
量子位
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
Google DeepMind News
Google DeepMind News
小众软件
小众软件
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS
Upgrade to Node v18 for Ghost CMS & common errors
Bright Themes · 2023-11-02 · via Example blog

Starting with version 5.71.0 Ghost has dropped support for Node 16. This means for newer Ghost CMS version you need to upgrade your Node version to 18. The current recommended Node version is Node v18 Hydrogen LTS.

It's a good idea to keep up-to-date with the recommended Node version for Ghost, because that version is used in production on Ghost(Pro) which means it's heavily tested and issues are actively fixed by the Ghost core team.

How to upgrade Node.js

Node has changed their distribution method, which means there are some configuration adjustments necessary in order to upgrade.

Follow the steps below to upgrade:

  1. Download and import the Nodesource GPG key
# Update local package index
sudo apt-get update
# Install necessary packages for downloading and verifying new repository information
sudo apt-get install -y ca-certificates curl gnupg
# Create a directory for the new repository's keyring, if it doesn't exist
sudo mkdir -p /etc/apt/keyrings
# Download the new repository's GPG key and save it in the keyring directory
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
  1. Create deb repository
# Define the desired Node.js major version
NODE_MAJOR=18
# Add the new repository's source list with its GPG key for package verification
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
  1. Install/upgrade Node.js:
# Update local package index to recognize the new repository
sudo apt-get update
# Install Node.js from the new repository
sudo apt-get install -y nodejs

Update your Ghost version

Ghost doesn't recommend updating Node and Ghost at the same time. Reinstalling the current version of Ghost ensures that Node is updated correctly first, and that should make the Ghost updated process smooth.

  1. Find out your current Ghost version:
ghost version
  1. To reinstall the current version of Ghost:
ghost update {your_version} --force

The --force addition makes sure to trigger a re-install of dependencies.

Error "connect ECONNREFUSED ::1:3306"

After the NodeJS upgrade and trying to run ghost update, even though the update process was successful, I got the following error:

Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
Help: Unknown database error

Turns out this is because Node v18 prefers ipv6 resolution over ipv4. Depending on your MySQL configuration if it isn't listening on the ipv6 interface then node won't be able to connect to it.

There is a quick fix for this, by changing your database host from localhost to 127.0.0.1 in your Ghost config.

To do this:

  1. Open your config.production.js file
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "your_user",
      "password": "your_pw",
      "database": "your_db"
    }
  },
  1. In the database section, change the host property, then save the file
"host": "127.0.0.1"
  1. Restart ghost
ghost restart

Your ghost instance should be starting now.