-
Notifications
You must be signed in to change notification settings - Fork 3k
Global module installation should fail more rapidly, if sudo isn't used #15244
Comments
You could try |
That would require the user to memorize and run a separate command, rather than focusing on their intent, which is to install a Node module globally. Not a very good solution from a user experience standpoint. |
@pcgeek86 I agree, but you could just run |
I'm not sure what the cost would be to improve the UX here. Hopefully it wouldn't cost too much development time, or system resources, to perform a simple check for root access, prior to resolving dependencies and installing them. However, I'm not personally familiar with the |
Ok. Thanks for the feedback. The check could be performed at the start of |
Cool, I'm just curious why specifically it would take a significant amount of work? From my limited point of view, it would be fairly simple to test for filesystem permissions, validate group membership, or otherwise figure out if the user has root permissions. What part of this validation would require a significant amount of effort? Cheers |
It depends on where you would want to put it. You could probably put a simple check here, or for more work you could make it fit with all of the chaining and the |
We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete. If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR. For more information about our new issue aging policies and why we've instituted them please see our blog post. |
I'm opening this issue because:
What's going wrong?
On Mac OS X 10.12 (Sierra), when I perform a global install without
sudo
(eg.npm install <package> -g
), it takesnpm
some time to indicate an access failure. Before the "access denied" message is printed, the module dependencies are apparently resolved, rather than immediately failing.In my opinion, this should fail earlier in the process, if adequate permissions aren't available for a global module installation. I'm not sure what the best solution to this is, as I'm not familiar with the
npm
source code, but wanted to provide a user story surrounding this.How can the CLI team reproduce the problem?
supporting information:
npm -v
prints: 4.0.5node -v
prints: v7.2.1npm config get registry
prints: https://registry.npmjs.org/What's the feature?
Fail early, if user doesn't have proper filesystem access to install Node modules globally.
What problem is the feature intended to solve?
User frustration / wasted time.
Is the absence of this feature blocking you or your team? If so, how?
This is a non-blocking feature. Just an annoyance.
Is this feature similar to an existing feature in another tool?
No.
Is this a feature you're prepared to implement, with support from the npm CLI team?
No.
The text was updated successfully, but these errors were encountered: