yarn install fails with permission denied error

Created on 15 Dec 2017  ยท  7Comments  ยท  Source: yarnpkg/yarn

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
triaged

Most helpful comment

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

All 7 comments

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(

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

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

I solved this by updating yarn version from 0.x to 1.x ๐Ÿ˜…

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

I have the same problem, but with:

rm -r node_modules
yarn cache clean
yarn install

it worked perfectly!

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.

Was this page helpful?
0 / 5 - 0 ratings