npm-check-updatesインストール時に「npm ERR! gyp verb `which` failed Error: not found: python」
今回はnpm-check-updatesをインストールしようとしたときに下記のエラーが起きたときの対処法についてご紹介いたします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
npm ERR! code 1 npm ERR! path /usr/local/test-web/node_modules/node-sass npm ERR! command failed npm ERR! command sh -c -- node scripts/build.js npm ERR! Building: /usr/local/bin/node /usr/local/test-web/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm ERR! gyp info it worked if it ends with ok npm ERR! gyp verb cli [ npm ERR! gyp verb cli '/usr/local/bin/node', npm ERR! gyp verb cli '/usr/local/test-web/node_modules/node-gyp/bin/node-gyp.js', npm ERR! gyp verb cli 'rebuild', npm ERR! gyp verb cli '--verbose', npm ERR! gyp verb cli '--libsass_ext=', npm ERR! gyp verb cli '--libsass_cflags=', npm ERR! gyp verb cli '--libsass_ldflags=', npm ERR! gyp verb cli '--libsass_library=' npm ERR! gyp verb cli ] npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@16.20.2 | linux | x64 npm ERR! gyp verb command rebuild [] npm ERR! gyp verb command clean [] npm ERR! gyp verb clean removing "build" directory npm ERR! gyp verb command configure [] npm ERR! gyp verb check python checking for Python executable "python2" in the PATH npm ERR! gyp verb `which` failed Error: not found: python2 npm ERR! gyp verb `which` failed at getNotFoundError (/usr/local/test-web/node_modules/which/which.js:13:12) npm ERR! gyp verb `which` failed at F (/usr/local/test-web/node_modules/which/which.js:68:19) npm ERR! gyp verb `which` failed at E (/usr/local/test-web/node_modules/which/which.js:80:29) npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/which/which.js:89:16 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/index.js:42:5 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/mode.js:8:5 npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) npm ERR! gyp verb `which` failed python2 Error: not found: python2 npm ERR! gyp verb `which` failed at getNotFoundError (/usr/local/test-web/node_modules/which/which.js:13:12) npm ERR! gyp verb `which` failed at F (/usr/local/test-web/node_modules/which/which.js:68:19) npm ERR! gyp verb `which` failed at E (/usr/local/test-web/node_modules/which/which.js:80:29) npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/which/which.js:89:16 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/index.js:42:5 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/mode.js:8:5 npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) { npm ERR! gyp verb `which` failed code: 'ENOENT' npm ERR! gyp verb `which` failed } npm ERR! gyp verb check python checking for Python executable "python" in the PATH npm ERR! gyp verb `which` failed Error: not found: python npm ERR! gyp verb `which` failed at getNotFoundError (/usr/local/test-web/node_modules/which/which.js:13:12) npm ERR! gyp verb `which` failed at F (/usr/local/test-web/node_modules/which/which.js:68:19) npm ERR! gyp verb `which` failed at E (/usr/local/test-web/node_modules/which/which.js:80:29) npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/which/which.js:89:16 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/index.js:42:5 npm ERR! gyp verb `which` failed at /usr/local/test-web/node_modules/isexe/mode.js:8:5 npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) npm ERR! gyp verb `which` failed python Error: not found: python npm ERR! gyp verb `which` failed at getNotFoundError (/usr/local/test-web/node_modules/which/which.js:13:12) npm ERR! gyp Build failed with error code: 1 |
Node.jsのバージョンは20.12.2です。
npm-check-updatesインストール時に「npm ERR! gyp verb which
failed Error: not found: python」
結論から言うと、Node.jsのバージョンを一時的に落とせば上記のエラーは出なくなり、npm-check-updatesを正常にインストールできるようになります。
私はNode.jsのバージョンを一時的に14.21.3にしたところ正常にインストールできました。
npm-check-updatesはpackage.jsonに書かれているライブラリやフレームワークのバージョンを最大まで上げるツールですが、Node.jsのバージョンを一時的に落とす分には問題ないです。
Node.jsのバージョンを落としてからnpm-check-updatesでpackage.jsonを更新したらまたNode.jsのバージョンを元に戻せば良いだけですね。
終わりに
今回はnpm-check-updatesをインストールしようとしたときに冒頭のエラーが起きたときの対処法についてご紹介いたしました。
ディスカッション
コメント一覧
まだ、コメントがありません