title: How to fix `sh: ___: command not found` for NPM Modules
body: <p>I'm relatively new to Node development and I'm trying out various modules, frameworks, etc.. I'm on macOS Catalina. I've changed my NPM root and $PATH while trying to get things to work, and I think I broke something, though I'm not exactly sure what. My issue is very specifically with NPM, which is having a persistent problem running installed modules both locally and globally. When I try to install a dev tool like Nodemon or a framework like Electron, I get error codes like:</p>
  
  <pre><code>sh: electron: command not found
  npm ERR! code ELIFECYCLE
  npm ERR! syscall spawn
  npm ERR! file sh
  npm ERR! errno ENOENT
  npm ERR! electron-quick-start@1.0.0 start: `electron .`
  npm ERR! spawn ENOENT
  npm ERR! 
  npm ERR! Failed at the electron-quick-start@1.0.0 start script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  </code></pre>
  
  <p>I've consulted a lot of resources and a lot of questions on this site, but I'm not experienced enough to accurately troubleshoot this issue and identify what's going on. While I'm shooting in the dark, I may be fixing one thing and breaking another, so I'm coming here to see if I can get a comprehensive answer.</p>
  
  <p>I'll add that I've found a few workarounds, if this makes the issue clearer at all. I can get some modules (in this example Nodemon) to run by adding this "dev" script to the package.json:</p>
  
  <pre><code>"scripts": {
      "dev": "node ./node_modules/.bin/nodemon server.js"
    }
  </code></pre>
  
  <p>So I can access local project modules by specifying the path of the Module, but I can't just say "nodemon server.js", either in the dev script or from the command line, where it should have been installed globally. If I look in the specified <code>npm -g root</code> folder, the packages I'm trying to run are definitely in there, so it's not an installation issue.</p>
  
  <p>Any guidance y'all have is greatly appreciated, as I don't know what to make of all this.</p>