Site cover image

Site icon imageastro-notion-blog-test

make blog with notion

Post title iconnotion-astro-blogをローカル環境に構築する際のエラーの解決

ローカル環境構築時に発生した問題

  • 2024-11-12現在でNode.js v22の環境だと npm install 時に node-gypre2 のインストールで次のエラーが発生する。
//エラー例(全文ではない)
npm install
npm error code ENOTEMPTY
npm error syscall rename
npm error path /Users/tomoyukikishi/Desktop/astro-notion-blog/node_modules/sharp
npm error dest /Users/tomoyukikishi/Desktop/astro-notion-blog/node_modules/.sharp-EnIP9LeF
npm error errno -66
npm error ENOTEMPTY: directory not empty, rename '/Users/tomoyukikishi/Desktop/astro-notion-blog/node_modules/sharp' -> '/Users/tomoyukikishi/Desktop/astro-notion-blog/node_modules/.sharp-EnIP9LeF'

結論

  • nodeのバージョンによる問題みたいなので、下記のコマンドで20.11.0をインストールすることで解決しました
nvm install 20.11.0
補足

nvmとは

  • バージョン指定してnodeをインストールできるライブラリ
  • nvmのインストールコマンド
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
参考

https://qiita.com/ffggss/items/94f1c4c5d311db2ec71a