-
Notifications
You must be signed in to change notification settings - Fork 30k
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
is installed wrongly on windows machine
#53538
Comments
Maybe related to npm/cli#7089? |
cc @nodejs/npm this impacts all windows npm users. |
Also we used to create |
@anonrig Can you post the details of the log |
|
Does |
It might but running it would destroy the repro in case someone needs it? |
I've looked into this issue and seen that this is caused by stopping creating There are workarounds mentioned on the internet. Their basic idea is to create the appropriate folder, either manually by creating an empty folder or by installing a global module. The basic command to create this folder would be Additionally, you could install the module as an extra step before running The npx documentation might be misleading for some users. It can be updated accordingly. @lukekarrys, I tried from cmd and it is the same. |
This might be a security issue, but regardless we should never ship a broken/buggy software. If this is indeed the default behavior, than I ask myself "why are we shipping a broken feature on Windows?" cc @nodejs/tsc |
@MylesBorins I think this requires your attention |
@nodejs/npm |
@anonrig why did you tag this tsc-agenda? What benefit would this get from a 20 person meeting? |
Here are excerpts from some of my own comments from internal discussions that led up to 0ae8bf8.
So while we weren't certain at the time, we did consider the possibility that on some Windows systems, this patch might re-introduce some old npm issues. I still don't see a reasonable way for the Node.js installer to create that directory. What I'm wondering is if npm is assuming the directory exists (and it doesn't) or if npm would create the directory (but can't). |
It seems like a UX issue that can be addressed with better docs and better suggestions in the errors. But it seems more appropriate to just switch to npm/cli#7089 |
I don't see why npm couldn't create the directory when needed. It is in a path that belongs to the current user so permissions shouldn't be an issue |
iirc node tweaks the npm prefix on windows in: I believe that custom path does solve a few problems in windows but given that is not the default path that the standalone npm client is using it creates a split for windows users and can easily be a blind spot for the npm team to maintain. If my assumptions above are not wrong, the fix would be for the npm cli team to clean up that prefix story on windows so that's straightforward to support it moving forward and of course start to create that missing folder (in case that's the one they want to standardize on). |
@benjamingr I understand you but you should know that: I've added the |
That's interesting because the npm docs say:
|
@richardlau sounds like my assumptions might be wrong then 😅 |
Does this affect all Windows users or just a subset? I'm a bit surprised we haven't heard more complaints about this if it does affect all users. |
I installed it through nodejs website and running on windows 11. I assume it is all users. |
This issue has happened a few times in recent years, and has been answered but not really solved.
|
This should only affect users that never installed Node.js while installer was making that folder. As I recall when uninstalling Node, that directory wasn't removed, so it'd stay there unless you manually delete it, which I doubt a lot of people did. |
Creating the folder from the MSI is problematic for multiple reasons, not only because of security concerns. I don't think this is something we can cleanly fix inside the installer, except through some user instructions or best-effort approach. |
nodejs/help#4436 seems to be reporting a similar issue, are they related? |
It has been 2 weeks, and there is still no solution available from NPM team. @nodejs/npm @nodejs/tsc |
No it's been years, but if you feel so strongly about this, you can fix it yourself as it is open source and you can submit code for review. Otherwise, just gonna have to live with:
|
Does |
If 0ae8bf8 did indeed re-introduce this issue, then it's been there for more than a year already. I am not sure what the TSC can do about this since we don't maintain npm and no solution has been suggested within Node.js itself. |
@tniessen It means we are shipping unmaintained code for more than a year. How does this don't concern TSC? |
What do you want to discuss in a meeting? |
You're going to have to accept the fact this isn't in fact a high severity bug from most people's PoV given you're the first one to complain about it afaict and it's been this way for about a year and it's a bug in a third-party program that can be fixed in that program (and it looks like it isn't a high priority for them either). When stuff breaks people typically complain very quickly, if you believe this is in error tagging this tsc-agenda multiple times and pinging people multiple times won't help. You know exactly what happens when this gets brought up in a TSC meeting:
The TSC is a leadership body not the owner of Node.js, collaborators own the code. You need to motivate someone to fix it or to fix it yourself. You were a TSC voting member you realize how the process works. You have a lot of trust, friends and good faith in the project - I feel silly telling you all of this but I feel like you're needlessly frustrated around this all so I felt it's all worth explaining super clearly. |
don't think so, their issue was non-output to Powershell using npm vs npm.cmd, so most likely an AutoRun config is on their global or user scope for that particular command path. but if their issue wasn't caused by user error or Chocolately/3rd party package manager install (ie at some point the default was changed to enable AutoRun), then it probably would be related as that and this issue affect the same type of system process for command aliasing, however that works under the hood. |
Was on the TSC agenda as an FYI to raise awareness. It was discussed in meeting today so taking offf the agenda. |
I don't know enough about Windows so pardon my ignorance, but why exactly can't npm create
I don't have a Windows machine right now so can't verify but my impression is that creating a folder at |
Hi everyone! This might be my first time in a Node forum as the (new) PM for npm. I'm glad to be here! Thanks everyone for raising the concerns and the good discussion. I've briefly watched the TSC recording and I agree there are areas for improvement. While the My team was able to pick this up and a fix should be on the way. |
Oddly, I was unable to get around this issue in GitHub Actions until I ran |
Issue is fixed with npm/cli#7640 |
Thanks @anonrig for making sure that this got solved! Our users are running into this issue right now, so I'm glad to see that a fix is in place. I'm a bit confused about why it's still happening right now, though, on new installs of Node.js: npm/cli#7640 was merged in July and got released in NPM 10.8.3, if I'm reading npm/cli@9214be9 correctly. The various installers currently appear to still ship 10.8.2 by default though (see below image) - I assume because there's some bake time before the next NPM release gets promoted up, but can I ask when NPM 10.8.3 will be shipped by default in the Node.js installer? |
I'm getting the following error when trying to run a simple npx command on Windows. I opened the issue to this repository because we are distributing
npm
, we define the location ofnpm
in a Windows machine.I reinstalled Node.js from
nodejs.org
with the latest v22, and I can not usenpm
at all. Any input/help is appreciated.PS: I'm using PowerShell.
cc @nodejs/platform-windows
The text was updated successfully, but these errors were encountered: