Yarn: Permission denied for package after using yarn link

Created on 6 Jun 2017  路  21Comments  路  Source: yarnpkg/yarn

I have a package where I ran yarn link. Then, I ran yarn link my-package at another folder.
Then, when I ran my-package I got:

bash: /home/myuser/.npm-global/bin/my-package: Permission denied

I had not the same problem with npm link.

Seems like Yarn isn't linking binaries the same way as NPM.

Node: 6.10.3
Yarn: 0.24.5
OS: Linux Mint 18 Cinnamon 64-bit

cat-bug triaged

Most helpful comment

Fixed it by doing chmod +x on the linked bin file

All 21 comments

Just hit the exact same issue. Seems to have worked at first, but then I started getting permission denied. I tried deleting the symlink and recreating manually, but no luck.

Node 8.1.2
Yarn 0.24.6
MacOS 10.12.5

Fixed it by doing chmod +x on the linked bin file

Fixed it by doing chmod +x on the linked bin file

Fixed it for me as well, but I'm curious why this is happening now. Never used to be an issue for me

EDIT 1
Node v8.0.0
Yarn v0.27.5
MacOS v10.12.6

EDIT 2
Looks like if the binary file has a .js extension, this issue doesn't happen. Only happens for me when the file has no extension

The file I had to use chmod +x on did have a .js extension

In npm they always ensure that bins are executable during the build phase.

Should yarn be doing the same?

I think this is the case now so closing. If not, please reopen and provide more details like your Yarn version etc.

I'm getting this issue.
I use yarn link, then execute the package's binary file and get the permission error.
Of course I can make the bin executable, but every time I change the executable (as you tend to do during development), it becomes non-executable again.

How can I do that automatically?

node 8.8.1
yarn 1.2.1

I am also getting this issue and the chmod +x fix above works for me as well. However, every time I run yarn at the root (of my monorepo i.e. build triggered in each package) I get the same old error again since the file is changing. I'm using Lerna with Yarn workspaces enabled. Is there any fix coming for this?

Node: 8.9.1
Yarn: 1.3.2

@batjko Have you managed get a solid workaround in the meantime? Thanks in advance 馃憤

@BYK Please advise what to do since you mentioned this may no longer be the case, otherwise I think this issue should be reopened.

we're getting it too over here:

Node: 9.5.0
Yarn: 1.3.2

Also getting it. Maybe worth noting that if I do an npm link, npm unlink, and then yarn link it seems to work. But if I do a yarn link from the beginning I get the permission issue.

Node: 8.9.4
Yarn 1.3.2
OS: mac 10.13.3

Also seeing this. Seems pretty janky to use yarn for most of my operations, but then be stuck with npm link for this one.

I'm having this error too. Also changed permission of my global /bin/sh file but still an error. @allotrop3 @jharris4 How did you fix this? Can you please help me on it.
/bin/sh: 1: plone-react: Permission denied
Here plone-react is symlinked package.

This is still an issue with yarn 1.19.1. Why is this this issue closed?

It still being an issue to me too

Still an issue

Yeah it is still an issue with yarn 1.19.1.

Still an issue with yarn 1.21.1

Almost 3 years later, still an issue and closed for whatever reason.

Still an issue with yarn 1.22.4

Still an issue, yarn should make the binaries executables before linking

Experiencing this issue currently

Was this page helpful?
0 / 5 - 0 ratings