You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
BUG
What is the current behavior?
Ansible uses sudo to change the efective user when a command is launched. When Yarn is used using sudo with an unprivileged user, it tries to write files in the global node_modules directory.
If Yarn is executed by that user (without sudo), everything works as expected storing the modules in the node_modules directory of the directory of the project.
If the current behavior is a bug, please provide the steps to reproduce.
Here it is an example of the issue using the Fedora box with Vagrant:
[root@fedora nodejs-project]# sudo -u vagrant id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)
[root@fedora nodejs-project]# sudo -u vagrant yarn install
/usr/share/yarn/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/local/share/.yarn'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
at Function.sync (/usr/share/yarn/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:30:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
[root@fedora nodejs-project]#
[root@fedora nodejs-project]# exit
[vagrant@fedora nodejs-project]$ yarn install
yarn install v0.17.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 7.95s.
What is the expected behavior?
Something like this:
In this specific context, it seems that a combination of various sudo commands until ansible-playbook was invoked (and later, the yarn install task getting run through sudo again) made Yarn confused about which user it was running as (even though it was confirmed it was running as the 'vagrant' user through 'ps').
It's curious npm install in the same situation did not seem to face this error.
amatas
added a commit
to amatas/yarn
that referenced
this issue
Dec 3, 2016
Do you want to request a feature or report a bug?
BUG
What is the current behavior?
Ansible uses sudo to change the efective user when a command is launched. When Yarn is used using sudo with an unprivileged user, it tries to write files in the global
node_modules
directory.If Yarn is executed by that user (without sudo), everything works as expected storing the modules in the
node_modules
directory of the directory of the project.If the current behavior is a bug, please provide the steps to reproduce.
Here it is an example of the issue using the Fedora box with Vagrant:
What is the expected behavior?
Something like this:
Please mention your node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: