Yarn: Permission denied

yarn

#1

Over the last few weeks a lot of builds fail with the following error:

yarn install
/bin/bash: /usr/local/bin/yarn: Permission denied
Exited with code 1

Restarting the builds mostly helps but this is a big problem for us and needs to be fixed on your backend.


#2

Can you try resetting the permissions yourself? Maybe something like this:

sudo u+x /usr/local/bin/yarn

Try this either in the same install statement (sudo npm install .... && sudo u+x ...) or in a separate run clause.


#3

I’m having the same issue, did you have any progress to solve that?

When I use npm install -g yarnpkg instead of npm i -g yarn it works, not sure if that issue it’s related to the last yarn version.

Regards


#4

What version of Yarn are you using? What base image are you using? Are you using Circle 1.0 or 2.0? Putting all that in your question may be helpful.

Hmm, I don’t use Yarn, but would sudo yarn install make a difference? Maybe it needs root perms to do its own installation stuff.

Same to @schickling.


#5

I have seen the same error using CircleCI 2.0. Seems intermittent. I run
npm i -g yarn
And then
yarn install

Out of 25 containers that are all identical, only 1 will fail. I wasn’t seeing this before trying to update the yarn version on the base circleci image (using circleci/ruby:2.3.4-node-browsers).


#6

Any update on this from the Circle team?


#7

Hey, I know this is not a “proper” solution, but it worked out for me; I changed

run: sudo npm install -g yarn

to

- run:
    name: install
    command: |
      sudo npm install -g yarn
      yarn install

and the error was gone.

Hope this helps you. Would love to hear the proper solution though! :slightly_smiling_face:


#8

@maticzav: you can probably shorten that to run: sudo npm install -g yarn && yarn install, if you want to avoid the multiline format.

I don’t know Yarn, but it looks fine to me.


#9

@halfer thanks for your suggestion! I agree, that should work as it is the same thing just written differently.

I don’t know why but the initial statement, which is the same as the one you proposed, for some reason stucks on permission error that @schickling described. I haven’t tried executing your idea, but I know that the one we used before didn’t work. Switching to the multiline, on the other hand, fixed the problem.

I hope we find a better solution anyways!


#10

I hadn’t realised yarn is preinstalled in the 2.0 node images. Using the preinstalled version (rather than installing a new one with npm) fixed the permissions issues for me.

https://circleci.com/docs/2.0/yarn/


#11

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.