👻

Setup Zenn CLI on Ubuntu 24.04

に公開

Setup Zenn CLI on Ubuntu 24.04

Install Node.js on Ubuntu 24.04

Ubuntu default nodejs vesion is too old for zenn-cli

https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions

Install Node 22

https://nodejs.org/en/download

# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 22

# Verify the Node.js version:
node -v # Should print "v22.20.0".

# Verify npm version:
npm -v # Should print "10.9.3".

Install zenn-cli

Requirements:

  • node.js
  • nvm
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.

Discussion