-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm seems to be tripping on asdf #162
Comments
I don't think we will be able to fix this on the asdf side (at least not without changing how shims work). The shim will always be on your |
Yep, I noticed something similar when using asdf-ocaml, the way it works in the ocaml plugin is, it has an So I guess it would be fine for this to be handled on a per-plugin basis, and asdf-node should setup the correct env for running its shims. |
While it is a somewhat older issue, using |
Is there a way to fix this without |
Unfortunately, I haven't found anything that would result in a permanent fix. This is probably the reason that the Maybe, in the case of NPM there are additional path issues since you can have "local" packages and "global" packages that have the same name I guess. I'm not sure, it's probably really tricky to fix though. In some cases I end up reshimming or removing some of the lang-plugins because I think the issue lies within. Then later, I find out that it was because (I'm on a mac btw) Homebrew node was used instead of ASDF node. So be sure to check that too if you happen to use Homebrew :) |
@SidOfc your advice to reshim and re-source zsh isn't working for me :(
|
Hmmn that is unfortunate @joemsak, I usually do a Also, which version of
As a last resort I would try reinstalling said Node version, I did this a few times for Node myself so you're not alone in these issues :)
Let me know what happens, good luck 👍 |
Just rebooted ... no difference :( |
@joemsak Woops! My bad, just did a quick Then retry the |
Ooh boy I should have figured that out on my own, sorry ... will report back asap |
Still the same issue .... npm does not update to 5.8.0, stays stuck at 5.6.0 ... everything else is also still the same |
@joemsak apologies for the late reply. In my specific case it is about node version 8.4.0 instead of 9.11.1, this seems to be something within asdf or asdf-nodejs. I'm going to figure out if I can make it work and will report back later. |
I see some time ago you had the same issue with node 9.9.0 here on asdf-vm/asdf-nodejs#56. cd ~/.asdf/installs/nodejs/[VERSION]/lib && npm i npm note: Do not forget to change "[VERSION]" with the actual nodejs version. Could you try and see if maybe this does work for 9.11.1? One can hope ;) |
From your screenshot I see you ran |
After earlier having applied 'npm config set scripts-prepend-node-path true' which I think was the command that broke webpack running for me. I fixed my issue by running:
-- thx to @SidOfc |
@Stratus3D pinging you to respond to @vic #162 (comment)
The warning is pretty annoying when launching even just a few processes. |
sorry @SidOfc, just did @evolve2k's advice in zsh / iterm2 in a new window:
|
@joemsak well, this time you are not in the correct location.
Once again, replace Note that I am not sure if this actually works, I've done it on macOS 10.12 (Sierra) and it did work for me so I am kinda assuming it works when executed properly. Since you haven't actually tried it the correct way I can not assure you that it does actually work. Good luck and keep the reports up, they provide us with details that you missed from the examples. It helps debugging what went wrong :) |
@SidOfc Sorry I should've mentioned that I tried all of your suggestions in order, verbatim, before posting my screenshot above. No luck. :( |
okay, sorry, you're right I missed your full instructions However, I do expect to just be able to update npm from wherever i'm using a .tool-versions file though Anyway, I have done as instructed and still face this issue. I am on 10.14 beta now but these issues had persisted on 10.13 stable. No other unix or OS based issues have come up for me and this is my primary development machine.
|
@corysimmons I checked your screenshot and I've also seen this error come by sometimes. I am however unsure how exactly I fixed those scenario's as it has been a while since I've last encountered it. The only thing I can really tell you is that I kept juggling with the above commands and somehow it started working (blergh, I hate giving inconclusive advice...) :( @joemsak no need to apologize, you have my apologies if it sounded harsh :) The behaviour you are describing should be possible too I think. One can just run I just tried this in one of my projects which uses Node. I am using npm version 5.5.1 locally and ran the above command ( $ cd /relevant/directory
$ npm -v
# => 5.5.1
$ npm i npm --save-dev
# => correctly installs npm 6.4.0 without errors
$ npm -v
# => 5.5.1
$ asdf reshim nodejs
$ npm -v
# => 5.5.1 I then started up a fresh shell session and did a It is definitely not your build @joemsak, nor your fault at all. All this black magic we have to perform simply makes no sense if you aren't actually managing such plugin interfaces. I barely have the knowledge to fix these issues myself, it is often a mystery to me. Perhaps we can take a more in-depth look into this by checking how this is handled, I'm quite busy currently but this is a long standing issue that could use some fresh infos so I'll see if I can put something together anytime soon. Meanwhile, just make sure you keep everything up-to-date and retry the above steps. Sometimes doing a complete uninstall and reinstall can fix some problems. Update oneliner: $ asdf update && asdf plugin-update --all Fish oneliner: $ asdf update; and asdf plugin-update --all Unfortunately, this is the best advice I can give at this time :/ Sid |
@SidOfc Appreciate your help but I'm done with I'll just have to manually remember to switch Node versions for certain projects and use |
Update I have been able to update npm after running |
Sorry to have been so absent from this discussion. Is anyone still having issues with this? |
@SidOfc seems like it's working okay for me after your oneliner |
Good to hear @joemsak! @Stratus3D I am not sure there, few folks have been active on this issue so maybe it can be closed as it seems to be working in the latest version for macOS at least. |
A simple |
It saved my day. Thank you! |
my issue was similar to others above but turns out it was a missing lib directory. I was careful to try some of the suggestions above to avoid making it worse but yes re-installing did not work. Replace The error was like:
The solution was to manually create the directory and try again.
My question is what happened that caused this directory to not be included upon install? |
@ar-to The plugin for the tool is what decides what files are installed so your question is best raised as a new issue on the |
I got an issue trying to create a global command to a CLI using |
Thank you, this fixed my issues when installing node
I was having the following error: $ npx nodemon
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path /home/user/.asdf/installs/nodejs/20.11.1/.npm
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat '/home/user/.asdf/installs/nodejs/20.11.1/.npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2024-11-10T13_04_50_319Z-debug-0.log |
Any invocation of
npm
on my system seems to be throwing this warning:A quick Google search brought me to this issue for npm. The most helpful bit being the last comment in the thread where @addaleax elaborated on the
--scripts-prepend-node-path
option.My current best guess is that on this line
process.execPath
returns the bin path, and not the shim path. It then compares the that to the shim path in$PATH
and raises alarms.This doesn't seem to be causing issues, because npm is adding the bin we want it to use anyways, but I still don't like the warning. If the root cause is fixable (on either side) then I would be a happy man. Failing that, can we at least acknowledge the
--scripts-prepend-node-path
flag here? Either setting it automatically inasdf-node
or leaving a message about it in the docs?P.S. I apologize if this issue should have been submitted on
asdf-node
, but I wasn't sure what implications this might have for the way asdf shims things in general.The text was updated successfully, but these errors were encountered: