Skip to content

yarn install fails with permission denied error #5095

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

Closed
Johannes42 opened this issue Dec 15, 2017 · 7 comments
Closed

yarn install fails with permission denied error #5095

Johannes42 opened this issue Dec 15, 2017 · 7 comments
Assignees
Labels

Comments

@Johannes42
Copy link

Do you want to request a feature or report a bug?
This is a bug report. Maybe related to #961

What is the current behavior?
yarn install fails while installing some packages with permission denied error.

error An unexpected error occurred: "EACCES: permission denied, unlink '/home/johannes/.cache/yarn/v1/npm-tsickle-0.25.5-2891d29f97c4aab1306e06378d8496d1765a4bfe/src/class_decorator_downlevel_transformer.d.ts'".

ll in the src folder gives following result:

dr-xr-x--x 2 johannes johannes 4096 Nov 15 02:12 ./
drwxrwxr-x 3 johannes johannes 4096 Dez 15 13:15 ../
-r-xr-x--- 1 johannes johannes  301 Nov 15 02:12 class_decorator_downlevel_transformer.d.ts*

Deleting this folder befor yarn install doesn't help.

If the current behavior is a bug, please provide the steps to reproduce.
Create a folder with the following package.json:

{
  "name": "testtsickleyarn",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "tsickle": "^0.25.5"
  }
}

Run yarn

What is the expected behavior?
The operation should succeed (as it does with npm install),

Please mention your node.js, yarn and operating system version.

  • Node v6.10.2
  • Yarn 1.3.2
  • Ubuntu 16.04
@ghost ghost assigned rally25rs Dec 15, 2017
@ghost ghost added the triaged label Dec 15, 2017
@rally25rs
Copy link
Contributor

I tried it out on OSX but don't get an error

~/Projects/yarn-test 🐒   cat package.json
{
  "name": "testtsickleyarn",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "tsickle": "^0.25.5"
  }
}

~/Projects/yarn-test 🐒   yarn
yarn install v1.3.2
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "typescript@>=2.4.2 <2.6".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 0.68s.

~/Projects/yarn-test 🐒   ls -l `yarn cache dir`/npm-tsickle-0.25.5-2891d29f97c4aab1306e06378d8496d1765a4bfe/src/
total 1944
-rwxr-xr--  1 jvalore  891112136     301 Nov 14 20:12 class_decorator_downlevel_transformer.d.ts
-rwxr-xr--  1 jvalore  891112136   22698 Nov 14 20:12 class_decorator_downlevel_transformer.js
...

It does look like #961 but that should have been fixed a long time ago.

From a quick search it looks like archives should be extracted with permissions set:

    const untarStream = tarFs.extract(this.dest, {
      strip: 1,
      dmode: 0o755, // all dirs should be readable
      fmode: 0o644, // all files should be readable
      chown: false, // don't chown. just leave as it is
    });

so I'm not sure why yours would be different. If you are willing to debug into it some, I think that the extraction of the archive should happen in

src/fetchers/git-fetcher.js

or

src/fetchers/tarball-fetcher.js

search for tarFs.extract(

@Johannes42
Copy link
Author

reinstalling of yarn helped. So this issue can be closed.

@carlospliego
Copy link

^ Classic case of "it works for me" still open in my mind.

@albohlabs
Copy link

I solved this by updating yarn version from 0.x to 1.x 😅

@miguelmota
Copy link

miguelmota commented May 12, 2018

Had same issue on macOS, solved it by reinstalling yarn

rm -rf /Users/mota/Library/Caches/Yarn/
brew uninstall yarn
brew update
brew install yarn

@MontoyaAndres
Copy link

MontoyaAndres commented Feb 3, 2019

I have the same problem, but with:

rm -r node_modules
yarn cache clean
yarn install

it worked perfectly!

@caroso1222
Copy link

Had same issue on macOS, solved it by reinstalling yarn

rm -rf /Users/mota/Library/Caches/Yarn/
brew uninstall yarn
brew update
brew install yarn

After messing around with chmods for 2 hours, this one just worked like a charm. Thanks.

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

No branches or pull requests

7 participants