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

globally installed packages have incorrect permissions (EACCES) #1060

Closed
soredake opened this issue Oct 14, 2016 · 23 comments
Closed

globally installed packages have incorrect permissions (EACCES) #1060

soredake opened this issue Oct 14, 2016 · 23 comments

Comments

@soredake
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
EACCES

$ gulp
fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/root/.yarn-cache/.global/node_modules/arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.Module._extensions..js (module.js:415:20)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/root/.yarn-cache/.global/node_modules/arr-diff/index.js:10:15)
    at Module._compile (module.js:409:26)

If the current behavior is a bug, please provide the steps to reproduce.
sudo npm i -g yarn
sudo yarn global add gulp
gulp

What is the expected behavior?
correct permissions

Please mention your node.js, yarn and operating system version.
Node v4.4.6
Yarn 0.15.1
Gentoo Stable

@Jmlevick
Copy link

Jmlevick commented Oct 15, 2016

Not gulp specific, globally installed packages are not usable because of incorrect permissions:

Do you want to request a feature or report a bug?
bug

What is the current behavior?
EACCES

manuelescudero@Manuel-Escudero ~/angular2> ng new project
fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/Users/manuelescudero/.yarn-cache/.global/node_modules/broccoli-viz/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.Module._extensions..js (module.js:578:20)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/manuelescudero/.yarn-cache/.global/node_modules/ember-cli/lib/models/builder.js:12:11)

If the current behavior is a bug, please provide the steps to reproduce.
brew update
brew install yarn
sudo yarn global add angular-cli
ng new project

What is the expected behavior?
correct permissions

Please mention your node.js, yarn and operating system version.
Node v6.8.1
Yarn 0.15.1
macOS Sierra 10.12

@soredake soredake changed the title EACCES trying to launch gulp globally installed packages have incorrect permissions (EACCES) Oct 15, 2016
@Psykukumber
Copy link

Can confirm this bug on Arch Linux

psykukumber@pklaptop:[~]$ sudo yarn global add npms-cli                       
yarn global v0.16.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed npms-cli@1.5.0 with binaries:
      - npms
Done in 16.93s.
psykukumber@pklaptop:[~]$ npms                            
zsh: permission denied: npms
psykukumber@pklaptop:[~]$ npms search
zsh: permission denied: npms

@adamchainz
Copy link

adamchainz commented Nov 23, 2016

Have this bug on yarn 0.17.8 , Node 6.9.1, Ubuntu.

$ sudo yarn global add gulp

Then as non-root user:

$ cd app; gulp
fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.Module._extensions..js (module.js:578:20)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/arr-diff/index.js:10:15)

Looks like #1344 was meant to fix this but only fixed the perrmissions on accessing the root package, not its dependencies. 😢

@iraklisg
Copy link

iraklisg commented Dec 9, 2016

I do confirm the bug trying to yarn global add vue-cli and then vue init webpack myproject

The error:

fs.js:557
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/arr-flatten/index.js'
    at Object.fs.openSync (fs.js:557:18)
    at Object.fs.readFileSync (fs.js:467:33)
    at Object.Module._extensions..js (module.js:581:20)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/arr-diff/index.js:10:15)
    at Module._compile (module.js:573:32)

@luke3butler
Copy link

luke3butler commented Dec 16, 2016

I'm having the same issue.
Installed yarn version 0.17.10

> forever start index.js

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.Module._extensions..js (module.js:578:20)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/arr-diff/index.js:10:15)

@luke3butler
Copy link

luke3butler commented Dec 19, 2016

After the upgrade to yarn 0.18.1, I don't have this issue anymore.
Edit: looks like the upgrade might fix it, but a fresh install still breaks for me on 0.18.1

@kris-ellery
Copy link

kris-ellery commented Dec 19, 2016

Same here when using Vagrant and installing globally.

Environment

ubuntu/trusty64: v20161214.0.0 
node: v6.9.2
yarn: v0.18.1

Error

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.Module._extensions..js (module.js:578:20)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/arr-diff/index.js:10:15)```

@luke3butler
Copy link

Looks like I spoke too soon. The upgrade may have fixed that particular installation, but a fresh install still has this issue.

@PowerKiKi
Copy link

Also seeing the bug with yarn global v0.18.1. A workaround would be to manually give read access to everybody with:

sudo chmod a+r -R /usr/local/share/.config/yarn/global/

@iraklisg
Copy link

iraklisg commented Dec 20, 2016

I have to say that I tried to repeat the steps in my previous comment, after upgrading to yarn 0.18.1, i.e.

yarn --version //0.18.1
yarn global add vue-cli 
vue init webpack myproject

After the upgrade the commands run without a problem (no EACCES: permission error)

@myfreax
Copy link

myfreax commented Dec 29, 2016

thank you @PowerKiKi ,I solved it

@hsz
Copy link

hsz commented Feb 13, 2017

I have tried with

yarn --version
0.19.1

The problem is still present. I have clean the cache and after fetching arr-flatten package - it's saved again with wrong permissions.

npm-array-unique also has this problem:

/home/tomcat/.cache/yarn$ ls -la * | grep "\-rwx\-\-\-\-\-\-" -B 5

npm-array-unique-0.2.1-a1d97ccafcbc2625cc70fadceb36a50c58b01a53:
total 168
drwxrwxr-x    2 tomcat tomcat   4096 Feb 13 13:21 .
drwxrwxr-x 1330 tomcat tomcat 139264 Feb 13 13:21 ..
-rwx------    1 tomcat tomcat    512 Mar 25  2015 index.js
-rwx------    1 tomcat tomcat   1088 Mar 25  2015 LICENSE
-rwx------    1 tomcat tomcat    862 Mar 25  2015 package.json
-rwx------    1 tomcat tomcat   1965 Mar 25  2015 README.md
--
npm-arr-flatten-1.0.1-e5ffe54d45e19f32f216e91eb99c8ce892bb604b:
total 168
drwxrwxr-x    2 tomcat tomcat   4096 Feb 13 13:21 .
drwxrwxr-x 1330 tomcat tomcat 139264 Feb 13 13:21 ..
-rwx------    1 tomcat tomcat    455 Mar 11  2015 index.js
-rwx------    1 tomcat tomcat   1088 Mar 11  2015 LICENSE
-rwx------    1 tomcat tomcat   1133 Mar 11  2015 package.json
-rwx------    1 tomcat tomcat   1845 Mar 11  2015 README.md

@PowerKiKi
Copy link

Starting from scratch with yarn 0.21.3 and still getting this error.

It seems to me that there is enough people who reported this to consider the issue "confirmed" (and thus remove the "needs confirmation")

@mknapik
Copy link

mknapik commented Mar 24, 2017

The error still lingers in yarn 0.20.3.
I installed packages as root and got an error when running tests as a non-root.


> jest

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/code/node_modules/arr-flatten/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.Module._extensions..js (module.js:578:20)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/code/node_modules/arr-diff/index.js:10:15)

@ishitatsuyuki
Copy link

@soredake Please add a reference to the fix if you confirm this is solved. Otherwise, please add some explanation of closure or reopen if it was a mistake.

@ishitatsuyuki
Copy link

PLEASE. DO. SOMETHING. @bestander @soredake

@bestander
Copy link
Member

Let's reopen this for now

@bestander bestander reopened this May 10, 2017
@iwinux
Copy link

iwinux commented May 30, 2017

I guess this is related with chroot?

$ yarn --version
v0.24.5

$ yarn global add yo

$ yo
/usr/local/share/.config/yarn/global/node_modules/mkdirp/index.js:90
                    throw err0;
                    ^

Error: EACCES: permission denied, mkdir '/root/.config'
    at Object.fs.mkdirSync (fs.js:894:18)
    at sync (/usr/local/share/.config/yarn/global/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/usr/local/share/.config/yarn/global/node_modules/mkdirp/index.js:77:24)
    at Configstore.get (/usr/local/share/.config/yarn/global/node_modules/configstore/index.js:38:13)
    at Configstore (/usr/local/share/.config/yarn/global/node_modules/configstore/index.js:27:44)
    at new Insight (/usr/local/share/.config/yarn/global/node_modules/insight/lib/index.js:37:34)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/yo/lib/cli.js:172:11)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)

@bestander
Copy link
Member

If someone can add a repro step that would help a lot.
I think the failure is related to how Yarn is installed.

@tfrijsewijk
Copy link

@bestander I think you're right. I had the same problem. I had yarn installed through npm. I uninstalled yarn and gulp:
npm uninstall yarn gulp --global
I installed yarn using the recommended practices here (in my case apt-get): https://yarnpkg.com/lang/en/docs/install/#linux-tab (See how it mentions that installing yarn with npm is not recommended on the alternative tab.. I never knew that)

I then installed gulp 4 using yarn: sudo yarn global add gulp-cli

@mbunge
Copy link

mbunge commented Oct 12, 2017

This issue appears to me on OSX if yarn (0.23.1) has been already installed with brew brew install yarn and install yarn 1.x with npm npm i -g yarn. I removed yarn from npm npm -g remove yarn und run brew upgrade yarn

@BYK
Copy link
Member

BYK commented Oct 27, 2017

Closing since this should be resolved in the recent versions of Yarn. Feel free to reopen with a repro script if it is still broken.

@Lawrence4code
Copy link

brew install yarn --without-node

This is worked for me.
I had to override the installation but it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests