npm / cli

the package manager for JavaScript

Home Page:https://docs.npmjs.com/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] "install -g" as user warns to late

buhtz opened this issue · comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Executing $ npm install -g <package> warns about that there are not enough permissions. Make sense because I am user not root.

The problem is that this warnings comes to late. There is a lot of downloading going on wasting time and resources (and carbon dioxid) before this warning comes up. I assuming npm can realize a bit more early that the requested job (install -g) is not possible in the current (user) environment.

Expected Behavior

Warn much earlier before wasting to much ressources.

Steps To Reproduce

See above.

Environment

  • npm: 9.2.0
  • Node.js: Don't know this component.
  • OS Name: Debian GNU/Linux 12 (bookworm)
  • System Model Name: What do you mean?
  • npm config: Debian default, don't know details
; "builtin" config from /usr/share/nodejs/npm/npmrc

globalignorefile = "/etc/npmignore"
prefix = "/usr/local"

; node bin location = /usr/bin/node
; node version = v18.19.0
; npm local prefix = /home/user
; npm version = 9.2.0
; cwd = /home/user
; HOME = /home/user
; Run `npm config ls -l` to show all defaults.
commented

This is more of a feature request than a bug report. General feedback is at https://github.com/npm/feedback/discussions.

commented

Yes it is a feature request improving usability and sustainability of npm. Why closing?