Skip to content

npm set wrong file ownership when installing global modules with sudo #13395

Closed

Description

@perqin

When using sudo npm install -g <some_module_name>, the ownership of the module directory (the directory located in /usr/lib/node_modules) and the npm cache directory (/root/.npm) are set to perqin:perqin, where perqin is the user running the sudo command.

Is it an intended behavior? I think they should be set to root:root.

Activity

  1. addaleax commented on Jun 2, 2017

    @addaleax
    Member

    This issue would better be raised at the https://github.com/npm/npm issue tracker; this one is only for problems with Node core itself, and while we bundle npm in our releases, the npm tracker is the right place to ask this kind of question, sorry. :)

  2. added a commit that references this issue on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions