Last active
September 15, 2021 08:00
-
-
Save hayakawatomoaki/d5ccb508cb897bf9c6f6 to your computer and use it in GitHub Desktop.
npmで「env: node: No such file or directory」とエラーが出たときの対応
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm -v | |
module.js:338 | |
throw err; | |
^ | |
Error: Cannot find module 'npmlog' | |
at Function.Module._resolveFilename (module.js:336:15) | |
at Function.Module._load (module.js:278:25) | |
at Module.require (module.js:365:17) | |
at require (module.js:384:17) | |
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:18:11 | |
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:86:3) | |
at Module._compile (module.js:460:26) | |
at Object.Module._extensions..js (module.js:478:10) | |
at Module.load (module.js:355:32) | |
at Function.Module._load (module.js:310:12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// もともとinstallされているnode,npm残骸が悪さをしているので削除 | |
$ sudo rm -rf /usr/local/lib/node_modules | |
// 削除されたことを確認 | |
$ npm -v | |
-bash: /usr/local/bin/npm: No such file or directory | |
// npmを再インスト | |
$ curl -0 -L http://npmjs.org/install.sh | sudo sh | |
// パスを通す | |
$ echo ‘export PATH=$PATH:~/.nodebrew/current/bin:~/.nodebrew/current/lib/node_modules/npm/bin’ >> | |
~/.bashrc | |
$ source ~/.bashrc | |
$ npm -v | |
2.10.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍
HomebrewのNode.jsを削除してもnvmの方のnodeを読みにいってくれなかったので
sudo rm -rf /usr/local/lib/node_modules
をしたら読みにいくようになりました。