LoginSignup
0
0

More than 1 year has passed since last update.

WSL+nvm(+node+npm)のインストールでエラったときの解決法

Last updated at Posted at 2022-10-28

WSLでnvmをインストールしたいけど、
ぜんぜんできなかったのでメモ。

結論

sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | sudo bash

sudoれ!

発生したエラー

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
~ ナイショ ~
node:net:361
    err = this._handle.open(fd);
                       ^

Error: EINVAL: invalid argument, uv_pipe_open
    at new Socket (node:net:361:24)
    at createWritableStdioStream (node:internal/bootstrap/switches/is_main_thread:78:18)
    at process.getStdout [as stdout] (node:internal/bootstrap/switches/is_main_thread:148:12)
    at console.get (node:internal/console/constructor:209:42)
    at console.value (node:internal/console/constructor:337:50)
    at console.log (node:internal/console/constructor:376:61)
    at evalScript (node:internal/process/execution:87:5)
    at node:internal/main/eval_string:27:3 {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'uv_pipe_open'
}
node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module '\\wsl$\Ubuntu-22.04\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Could not determine Node.js install directory
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0