这是indexloc提供的服务,不要输入任何密码
Skip to content

Permission errors on shared npm shim #901

@TylerGillson

Description

@TylerGillson

What version?

0.53.2+

Which command?

npm prefix -g

What happened?

I have a somewhat unique setup where my self-hosted Github runners each contain 4 runner processes that rely on a shared, global proto directory. Prior to v0.53.2 this was working perfectly.

Each runner uses the following config:

# proto
export PROTO_HOME="/home/.proto"
export PATH="$PROTO_HOME/shims:$PROTO_HOME/bin:$PATH"

The first runner process to run proto install -c global ends up owning the shim, e.g.,

-rwxrwxr-x 1 runner1 runner 621944 Nov  3 16:10 /home/.proto/shims/npm

Now if I run npm prefix -g as, say, runner2, I get this error:

Error: fs::perms

  × Failed to update permissions for /home/.proto/tools/npm/10.9.3/shims/npm.
  ╰─▶ Operation not permitted (os error 1)

It seems that proto is trying to chown the shim even though it's already group writable + executable.

I can work around this very hackily by prepending each runner's PATH with the actual node binary directory (bypassing the npm shim entirely) but that's definitely undesirable. E.g., if I export PATH="/home/.proto/tools/node/22.19.0/bin:$PROTO_HOME/shims:$PROTO_HOME/bin:$PATH" for runner2, the problem is resolved.

I get that the node_depman_tool changes in https://github.com/moonrepo/proto/releases/tag/v0.53.2 happened for a reason, but would it be possible to gate this new behaviour behind a configuration setting?

Trace logs?

No response

Operating system?

Linux

Architecture?

x64

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions