Closed8

ZennとGitHub連携できるらしいので連携したい

tet0htet0h

Githubにリポジトリを作ってzennとの連携は完了した。
次はZenn CLIを導入しようとした…がNode.jsがいる。
M1 MacにはまだNode.jsをいれてなかったのでこの機会に入れようとする…
がそういえばhomebrewもまだいれていなかった。
homebrewもまだM1のMacにいれてなかったのでこの機会に入れようとする。
homebrewはM1対応していたのをどっかでみたのをなんとなく覚えていた。
https://brew.sh/2021/02/05/homebrew-3.0.0/

tet0htet0h

インストールは

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

しただけで無事終わった。
がインストールされた/opt/homebrew にpathが通ってない。
インストール後のメッセージに

==> Next steps:

  • Add Homebrew to your PATH in /Users/hoge/.zprofile:
    echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/hoge/.zprofile
    eval $(/opt/homebrew/bin/brew shellenv)

とあったので言われた通りにする。
無事pathが通った。

tet0htet0h

よしインストールするぞと思ったら

Error: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install

と怒られる。あれ?入れてた気がするけど。
試しに brew doctor 叩いてみたら

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
  brew install git

Warning: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install

と言われている。
普通にgitコマンド叩けてるのになぜ?とりあえずcommand line toolはいれる。

tet0htet0h

command line tool入れたら
brew install nvm
で無事にインストール完了した。
インストールしたあと

Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.zshrc or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/opt/homebrew/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

と言われたので
$HOMEで mkdir ~/.nvm してそのあと ~/.zshrc に

export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

を追記してシェル起動し直したら無事バスも通った。
インストールされたバージョンは0.37.2。

tet0htet0h

nvm i v15.11.0
でインストール。
時間かかったけど無事完了。
node -v
v15.11.0

nvm current
v15.11.0

node -p process.arch
arm64

となったので大丈夫なはず。

tet0htet0h

やっとこさzenn cliをインストール。
https://zenn.dev/zenn/articles/install-zenn-cli
にしたがって進める。
npm init --yes
したら

npm notice New patch version of npm available! 7.6.0 -> 7.6.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.6.2
npm notice Run npm install -g npm@7.6.2 to update!

と言われた。

npm install -g npm@7.6.2
してから再度
npm install zenn-cli

npm install zenn-cli
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"

added 863 packages, and audited 864 packages in 34s

44 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

そのあと npx zenn init したあと npx zenn preview すると無事 http://localhost:8000 にアクセスするとプレビューできた。

このスクラップは2021/03/10にクローズされました