LinkStory Wiki
【Laravel】node_moduleインストール時のエラー1
エラー内容
旧来の node-sassは開発停止・互換問題が多く、Python2 を要求、Apple Silicon/Node18と相性最悪、古い依存(phantomjs-prebuilt/mozjpeg など)も巻き込みビルドに失敗。
主要エラー文抜粋
Python2 不在で node-gyp が停止(Python2を探す)
npm ERR! gyp info using [email protected]
npm ERR! gyp ERR! configure error
npm ERR! … Can't find Python executable "python"
npm ERR! gyp verb check python checking for Python executable "python2" … not found
Node18 + 古い依存の組合せエラー
npm ERR! path …/node_modules/node-sass
npm ERR! command sh -c node scripts/build.js
npm ERR! gyp info using [email protected] | darwin | arm64
解決方法
1.いちどクリーンアップする
rm -rf node_modules package-lock.json
npm cache verify
2.置き換え(Mix の世代にあわせて loader を選択)webpack5の場合
npm remove node-sass
npm i -D sass sass-loader@^13
3.再インストール&ビルド
npm i
npm run dev