pyright-python icon indicating copy to clipboard operation
pyright-python copied to clipboard

npx permission issue when PWD has different owner compared to install

Open miki725 opened this issue 2 years ago • 1 comments

a bit of context:

  • running things in docker in this case
  • docker image has a bunch of pre-commit hooks preinstalled
  • then mounting $PWD to actually run lint checks in CI
  • however github actions PWD does not belong to root which causes issues for npx
  • docker runtime user is root
  • since pwd in container has a different owner npx is not happy:
root@5ed5df3566d5:/home/yay# source /tmp/pyright-python.root/env/bin/activate

(env) root@5ed5df3566d5:/home/yay# id
uid=0(root) gid=0(root) groups=0(root)

(env) root@5ed5df3566d5:/home/yay# ls -la . | head -n2
total 28
drwx------ 1  970  970  218 Aug  2 03:07 .

(env) root@5ed5df3566d5:/home/yay# which npx
/tmp/pyright-python.root/env/bin/npx

(env) root@5ed5df3566d5:/home/yay# npx --version
8.19.1

(env) root@5ed5df3566d5:/home/yay# npx -- [email protected] --version
sh: 1: pyright: Permission denied

however if I cd to root home folder it works fine:

(env) root@5ed5df3566d5:/home/yay# cd

(env) root@5ed5df3566d5:~# npx -- [email protected] --version
pyright 1.1.271

any reason npx is used in general? it seems to be deprecated https://github.com/npm/npx

miki725 avatar Sep 19 '22 17:09 miki725

looks like it might be related to a bug in npm itself. if it gets resolved, this will need to switch to use npm exec vs npx which is deprecated now

https://github.com/npm/cli/issues/5533

miki725 avatar Sep 19 '22 20:09 miki725