Skip to content
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

[BUG] npm config set will change file owner #4482

Closed
2 tasks done
zWingz opened this issue Feb 28, 2022 · 1 comment
Closed
2 tasks done

[BUG] npm config set will change file owner #4482

zWingz opened this issue Feb 28, 2022 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@zWingz
Copy link

zWingz commented Feb 28, 2022

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

When I exec npm config set reigstry https://registry.npmjs.org/ in docker container, It will change all file's owner

image

  • whoami -> root
  • $HOME -> theia
    image

Expected Behavior

Do not change file owner

Steps To Reproduce

  1. mkdir test-123
  2. ls -al
  3. npm config set reigstry https://registry.npmjs.org/
  4. ls -al

Environment

  • npm:8.1.0
  • Node.js:16.13.0
  • OS Name:ubuntu:20
  • System Model Name:
  • npm config:
![image](https://user-images.githubusercontent.com/13031838/155972873-d36d1ca6-7c3b-4d7a-b6a3-7bd4c9e52ea7.png)
@zWingz zWingz added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 28, 2022
@nlf
Copy link
Contributor

nlf commented Mar 7, 2022

this is caused by npm attempting to force file ownership for files it writes to a user inferred by the parent directory. this feature was initially added to help users avoid issues where if they happened to run, for example, sudo npm i that we would write files owned by root into both their node_modules and their cache.

we've opened an RRFC issue to discuss how we can address this problem in the future, likely by either removing this file ownership change entirely or at the very least making it opt-in. you can follow the discussion here: npm/rfcs#546

since this is something that will require a lot of planning and time, and the current behavior while unfortunate is intentional, i'm going to close this in favor of the RRFC issue.

@nlf nlf closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

2 participants