カテゴリ:Tech投稿日:
node16系でnuxt2.15.0,node-sass6.0.1が入った環境にてyarn installをするとエラーになる
背景
ある日突然 node-sass が入ったフロントのローカル環境において yarn install をするとエラーが出るようになってしまった 🥲
結論
python2 系を使える状態にしてyarn install --force
またはnpm rebuild
することでエラーは解消され、無事処理が成功した。
詳細
使用端末
mac M1 Max
フロントの環境
node の version: 16.14.0
Nuxt: 2.15.0
node-sass: 6.0.1
エラー内容
一部だけ抜粋しました。
Building: /Users/hgoe/.anyenv/envs/nodenv/versions/16.14.0/bin/node /Users/hoge/Documents/fuga/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/Users/hoge/.anyenv/envs/nodenv/versions/16.14.0/bin/node',
gyp verb cli '/Users/hoge/Documents/fuga/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp verb find Python - executing "/Library/Developer/CommandLineTools/usr/bin/python3" to get version
gyp verb find Python - version is "3.9.6"
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp verb get node dir no --target version specified, falling back to host node version: 16.14.0
gyp verb command install [ '16.14.0' ]
gyp verb install input version string "16.14.0"
gyp verb install installing version: 16.14.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
解決手順
- Homebrew 経由で pyenv を導入。[1]
- pyenv 経由で python2, 3 を導入。[2]
- フロントの環境で
yarn install --force
またはnpm rebuild
を実行する。[3]
ブログ運営者
muuuuminn
経歴:
SE:1年半 → FE:5年 → ?スキル:
Next.js, TypeScript, React, Notion趣味:
ゲーム, 手品, 開発, コレクション, 映画