2

I've been attempting to update my npm globally using the npm install -g npm command in Git Bash to keep it current with Angular 11 and Node.js version 15.5.0. I receive the following error:

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

I deleted the file from nodejs and attempted to install again, but received another error about the npx.cmd. I deleted that file, attempt installation, and received an error about the npm file.

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npx.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm
npm ERR! Refusing to delete C:\Program Files\nodejs\npm: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

After deleting them and attempting to install npm again, Git Bash no longer finds npm. The installation never starts.

bash: /c/Program Files/nodejs/npm: No such file or directory

I tried to delete the npm file from my roaming folder in AppData, but received the following error:

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I've also tried the following at different times:

  • Delete node_modules and reinstall npm
  • Used npm 7.3.0's Git repository to create a new npm file (?) (I will need to find the suggestion online again to clarify/provide more specifics)
  • Clean caches
  • Uninstall and reinstall Angular 11 CLI and Node.js (tried for both LTS and Current version)

Nothing has worked so far. The second method I tried in the above list was able to update it to 6.14.10, but this attempt returned errors that seemed to affect Angular. I reverted everything to the original state to be safe. Please let me know if I can clarify anything else regarding my issue.

1 Answers1

0

I connected with another developer about the errors I've been receiving. The following approach was suggested, and it works for fixing the problem for LTS: How to completely remove node.js from Windows

The LTS version allowed me to update to npm's 6.14.11, but when I tried this approach to install the Current version, it stayed 6.14.11. Hopefully, this approach helps others who are experiencing similar errors.