When attempting to run npm install
, or when attempting to install anything through Node (like nvm) through any terminal (or in Visual Studio Code itself), I consistently get this error:
node:net:404
err = this._handle.open(fd);
^
Error: EISDIR: illegal operation on a directory, uv_pipe_open
at new Socket (node:net:404: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:210:42)
at console.value (node:internal/console/constructor:338:50)
at console.log (node:internal/console/constructor:377:61)
at evalScript (node:internal/process/execution:90:5)
at node:internal/main/eval_string:28:3 {
errno: -4068,
code: 'EISDIR',
syscall: 'uv_pipe_open'
}
Node.js v18.13.0
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'C:\node_modules\npm\bin\npm-cli.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.13.0
Could not determine Node.js install directory
I have reinstalled node.js, npm, WSL, and Visual Studio Code multiple times attempting to fix the issue. I have also followed the suggested solutions here, here, and here to no avail. I have ensured that node and npm are added to my PATH as well in the environment variables. So far I've had no luck attempting to fix this solution. What else can I try? Are there any steps I could be missing?