👻

Setup Zenn CLI on Ubuntu 22.04

2023/10/16に公開

Setup Zenn CLI on Ubuntu 22.04

Install Node.js on Ubuntu22.04

Ubuntu default nodejs vesion is too old for zenn-cli

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

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

NODE_MAJOR=20
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

Requirements:

  • 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.

Discussion