Having trouble running `npm install` in VSCode. Throws `npm ERR! code ENOENT` each time

Viewed 46

I am currently experiencing problems when running 'npm install' in my VSCode. I am running a laravel project with Vue.js. In the path that holds my package.json, I first installed node from the browser and now I' trying to run npm install in order to get the correct node_modules folder set up to run my application . I have tried the following solutions, but none have been able to resolve the problem.

I ran these commands:

npm install laravel-mix --save-dev
Npm install
Npm install && npm run dev
npm ci

I have also tried following this : npm install error from the terminal as well as double checking which directory package.json lives in.

This is the output of npm version

  npm: '8.15.0',
  node: '16.17.0',
  v8: '9.4.146.26-node.22',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.7',
  openssl: '1.1.1q+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022a',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

This is the error that I get when running npm install

npm ERR! code ENOENT
npm ERR! syscall spawn pwsh
npm ERR! path /Users/node_modules/deasync
npm ERR! errno -2
npm ERR! enoent spawn pwsh ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

I have tried to remove my project and re-clone it from git, as well as completely removing node from my computer and reinstalling it. Lastly, I installed avn and nvm to try and control the different node versions and make sure everything is compatible. I have also tried disabling any anti-virus software that I have running but none of those have worked either.

1 Answers

for anyone experiencing my problem, I ended up doing 3 things at once so I'm not completely sure which of these was the eventual solution:

  1. I disabled my firewall (I was running Sophos)

  2. I reset my permissions for the folder I was working in by first doing cd .. from the repo my project rested in and then running chown -R 502:20 [replace with directory where repo exists]

  3. and finally, I installed Power shell using brew install --cask powershell

Related