Setup Zenn CLI on Ubuntu 22.04


Setup Zenn CLI on Ubuntu 22.04

Install Node.js on Ubuntu22.04

Ubuntu default nodejs vesion is too old for zenn-cli


Install Node 20x

sudo apt-get update
sudo apt-get install -y 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

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

Install zenn-cli


  • node.js
cd zenn
npm init --yes
npm install zenn-cli

npx zenn --help

Create a new article

My personal rule when creating a new article.

npx zenn new:article --title "Setup Zenn CLI on Ubuntu 22.04"
created: articles/f92892a229bd90.md

Rename article file name to have human-readable slug as a prefix.

mv articles/f92892a229bd90.md articles/setup-zenn-cli-ubuntu-f92892a229bd90.md

The option --slug can specify the file name but it doesn't have random strings.
It's nice for me to have a random string in a new article file name.