Conflicting netlify CLI versions

Hey,
I have had some problems with figuring out high vulnerability packages in netlify’s cli. In the warning it said if I run npm audit fix --force it would install netlify-cli@17.5.1, which is a breaking change but I found that weird as I am using it as a dependency and the version is listed as

"devDependencies": {
		"netlify-cli": "^17.28.0"
	},

however if I run

(node:19172) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
netlify-cli/17.10.1 darwin-arm64 node-v21.4.0

I tried to run npm uninstall -g netlify-cli but returned:

up to date in 80ms

and then tried to install globally and got this back:

npm ERR! code EEXIST
npm ERR! path /opt/homebrew/bin/ntl
npm ERR! EEXIST: file already exists
npm ERR! File exists: /opt/homebrew/bin/ntl
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

I also happened to run it in the directory of the project where the CLI is saved as a dependency and returned this:

npm ERR! code EEXIST
npm ERR! path /opt/homebrew/bin/netlify
npm ERR! EEXIST: file already exists
npm ERR! File exists: /opt/homebrew/bin/netlify
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

Not sure how to update the CLI if I can’t uninstall it? I was following this thread who seemed to have a similar problem: Can not upgrade `netlify-cli` from v6.14.6 - #4 by coelmay

Thanks in advance!

Whatever you’ve done seems to have messed up with the installation on your system. I’m not sure what we can suggest outside of a device reset. This is no longer an error with the CLI or Netlify. NPM and/or your system is blocking the install. In any case, this is all I can think of for you to try:

  • Switch to a different package manager: Yarn, PNPM, Bun
  • Remove homebrew and clean all of its folders from the local system
  • Reinstall Node.js and npm and make sure all of its folders are deleted as well.

Thanks very much for your help. I had to use brew install netlify-cli and remove netflify as a dev dependency and it words great! Thanks for your patience!