Unable to find npm cli directory
Closed this issue · 6 comments
I recently upgraded to socket v0.14.27 and now i'm getting the following error in some directories:
Unable to find npm cli install directory, this is potentially a bug with socket-npm caused by changes to the npm cli.
Searched parent directories of /Users/sschurter/.nvm/versions/node/v22.5.1/lib/node_modules/socket/bin/npm
It does work in some directories.
My environment
❯ socket --version
0.14.27
❯ node --version
v22.5.1
❯ npm --version
10.8.2
Hi @samschurter 👋
Which version were you on where things were working?
@jdalton Unfortunately I do not know. When upgrading from Node 20 -> 22, I had some issue with the socket CLI and was in a hurry so I just disabled the alias, then forgot about it. Then a team member recently reminded me and I did a fresh install and it mostly works, there's just the occasional directory it breaks in.
Thank you @samschurter!
We resolve the npmRoot
directory by taking our directory
/Users/sschurter/.nvm/versions/node/v22.5.1/lib/node_modules/socket
and walking back until we find a npm
folder which is usually found in /Users/sschurter/.nvm/versions/node/v22.5.1/lib/node_modules/
.
@samschurter Please check your /Users/sschurter/.nvm/versions/node/v22.5.1/lib/node_modules/
folder and see if there is a npm
folder there or where it exists if you do which npm
and report back.
❯ which npm
/Users/sschurter/.nvm/versions/node/v22.5.1/bin/npm
I also confirmed that NPM does exist in the /Users/sschurter/.nvm/versions/node/v22.5.1/lib/node_modules/npm
folder. This has always been an intermittent issue for me, and right now I cannot recreate it even though I have not upgraded anything. A teammate @camden-obertop is able to recreate the error with version 0.14.27.
❯ which npm
/Users/cobertop/.nvm/versions/node/v20.18.1/bin/npm
However, upgrading to v0.14.33 resolved the issue. I'm going to upgrade as well and see if that fixes the issue. I will report back if I or anybody on the team runs into the issue again.
Thank you @samschurter!
Closing for now.