1

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?

Cameron Crane
  • 113
  • 1
  • 12
  • Try again in a virtual machine or in Docker. Focus on creating steps for someone else to _reproduce_ your issue. – Wyck Jan 10 '23 at 21:05
  • Then add how you install node and summarize those suggested "solutions". As you're running in WSL try first (or for ever) to get rid of Windows PATH: https://stackoverflow.com/questions/51336147/how-to-remove-the-win10s-path-from-wsl – JeffRSon Jan 10 '23 at 21:17

1 Answers1

0

I believe the issue was due to a corrupt installation of ubuntu itself, not node or WSL. Reinstalling ubuntu as a whole seemed to do the trick.

Cameron Crane
  • 113
  • 1
  • 12