Question about npm

So I have used npm within various projects through nix-shell. As of a couple of days ago, I was able to run some npm programs (spago, specifically) with ‘npx …’; unfortunately, this no longer works.

Interestingly, if I close the nix-shell (which contains nodejs) and type ‘npm’, the computer still recognizes the command, and upon invoking it with ‘npm --version’, it complains about dynamically linked executables. Now I would have expected ‘npm: command not found’ instead (nodejs, npm, etc. is not installed/enabled in my config). When invoking ‘where npm’ I get back ‘/home/xxx/.nvm/versions/node/v22.12.0/bin/npm’. I tried “resetting” the system with ‘nix-collect-garbage -d’ and also by rebuilding it, to no avail.

You must have at some point accidentally used nvm, which is a way to install npn without nix, and will not work on NixOS.

Remove its directory from your PATH, delete whatever it did to your bashrc and try to uninstall it.