yarn icon indicating copy to clipboard operation
yarn copied to clipboard

.roadrunner.json error

Open zeke opened this issue 10 years ago • 24 comments

:wave:

I just installed a nightly build of yarn to get all the latest goodies. Following the instructions at https://github.com/yarnpkg/yarn/issues/1474 and https://github.com/yarnpkg/website/pull/245:

wget https://yarnpkg.com/install.sh
chmod +x install.sh
install.sh --nightly

The install script told me to remove ~/.yarn so I did, then re-ran it. Now I get this error when I run yarn:

❯ yarn -V
0.17.0-20161107.1501
/Users/zeke/.yarn/bin/yarn.js:47
      throw err;
      ^

Error: ENOENT: no such file or directory, open '/Users/zeke/Library/Caches/Yarn/.roadrunner.json'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.writeFileSync (fs.js:1333:33)
    at /Users/zeke/.yarn/node_modules/roadrunner/index.js:25:6
    at /Users/zeke/.yarn/node_modules/roadrunner/index.js:12:12
    at emitOne (events.js:101:20)
    at process.emit (events.js:188:7)
    at processEmit [as emit] (/Users/zeke/.yarn/node_modules/signal-exit/index.js:140:35)
    at process.exit (internal/process.js:146:15)
    at Command.<anonymous> (/Users/zeke/.yarn/node_modules/commander/index.js:825:13)

Once I've actually used yarn to add a dep somewhere, this error goes away, pesumably because this directory is created as a side-effect of the installation process?

zeke avatar Nov 07 '16 20:11 zeke

I suspect this is due to #1638. @kittens

Daniel15 avatar Nov 07 '16 20:11 Daniel15

workaround: mkdir ~/Library/Caches/Yarn

develar avatar Nov 09 '16 06:11 develar

I have the same on Travis CI with a stable version (npm install -g yarn).

sapegin avatar Nov 14 '16 17:11 sapegin

It just happened to me using Ubuntu inside Virtual Box (host is Windows 10). As suggested above, I installed any package using yarn add and the error goes away.

jbruni avatar Nov 14 '16 18:11 jbruni

Same here on Arch Linux and [email protected]

reederz avatar Nov 14 '16 18:11 reederz

Same here when installed on CI via curl/bash:

curl -o- -L https://yarnpkg.com/install.sh | bash

results in:

$ curl -o- -L https://yarnpkg.com/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    94  100    94    0     0    637      0 --:--:-- --:--:-- --:--:--   639
100  3531  100  3531    0     0  22083      0 --:--:-- --:--:-- --:--:-- 22083
Installing Yarn!
> Downloading tarball...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    92  100    92    0     0    665      0 --:--:-- --:--:-- --:--:--   666
  0     0    0   595    0     0   3105      0 --:--:-- --:--:-- --:--:--  3105
100 3531k  100 3531k    0     0  13.3M      0 --:--:-- --:--:-- --:--:-- 56.5M
> Extracting to ~/.yarn...
> Adding to $PATH...
> We've added the following to your /home/ubuntu/.bashrc
> If this isn't the profile of your current shell then please add the following to your correct profile:

export PATH="$HOME/.yarn/bin:$PATH"

/home/ubuntu/.yarn/bin/yarn.js:47
      throw err;
      ^

Error: ENOENT: no such file or directory, open '/home/ubuntu/.cache/yarn/.roadrunner.json'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.writeFileSync (fs.js:1333:33)
    at /home/ubuntu/.yarn/node_modules/roadrunner/index.js:25:6
    at /home/ubuntu/.yarn/node_modules/roadrunner/index.js:12:12
    at emitOne (events.js:101:20)
    at process.emit (events.js:188:7)
    at processEmit [as emit] (/home/ubuntu/.yarn/node_modules/signal-exit/index.js:140:35)
    at process.exit (internal/process.js:146:15)
    at Command.<anonymous> (/home/ubuntu/.yarn/node_modules/commander/index.js:825:13)
> Yarn was installed, but doesn't seem to be working :(.

shaneog avatar Nov 14 '16 20:11 shaneog

Hitting this issue on heroku too. (ref https://github.com/heroku/heroku-buildpack-nodejs/issues/337#issuecomment-255140610)

amasad avatar Nov 14 '16 20:11 amasad

A temporary solution is to rollback to 0.16.1

Gpx avatar Nov 14 '16 20:11 Gpx

Having the same problem on CircleCI.

imontiel avatar Nov 14 '16 21:11 imontiel

If you're on Ubuntu or Debian, you can temporarily roll back by doing:

wget https://yarnpkg.com/downloads/0.16.1/yarn_0.16.1_all.deb
sudo dpkg -i yarn_0.16.1_all.deb

I'll work on keeping multiple versions of Yarn in the Debian repo to make it easier in the future.

Similarly, if you're using a tarball, you can download the tarball from https://yarnpkg.com/downloads/0.16.1/yarn-v0.16.1.tar.gz to get 0.16.1.

Daniel15 avatar Nov 15 '16 07:11 Daniel15

On Debian, when upgrading a globally installed yarn 0.16.1 through npm, the path is: '/usr/local/share/.cache/yarn/.roadrunner.json'. There's no cache or .cache in /usr/local/share; however, the directory '/usr/local/share/.yarn' exists and is empty.

bbak avatar Nov 15 '16 10:11 bbak

Ended up just doing npm install -g [email protected]. The rest of my app's versions are locked down, I suppose it makes sense to lock yarn as well.

imontiel avatar Nov 15 '16 15:11 imontiel

I'm going to work on adding a --version flag to the installer, and also having multiple versions in the Debian repo. That'll allow you to more easily lock down the version of Yarn.

Daniel15 avatar Nov 15 '16 16:11 Daniel15

I've updated the Debian repo to contain all releases, not just the latest one. I think we'll start suggesting locking the Yarn version for CI environments (such as CircleCI, TravisCI, etc). You can update the apt-get line in your build script to something like this:

sudo apt-get install -yy yarn=0.16.1-1

Which will always install 0.16.1, even if a newer version comes out. This should prevent your builds from breaking due to new Yarn releases! 😄

You can run apt-cache policy yarn to see a list of all available versions:

yarn:
  Installed: 0.16.1-1
  Candidate: 0.16.1-1
  Version table:
 *** 0.16.1-1 500
        500 http://dl.yarnpkg.com/debian stable/main amd64 Packages
        100 /var/lib/dpkg/status
     0.16.0-1 500
        500 http://dl.yarnpkg.com/debian stable/main amd64 Packages
     0.15.0-1 500
        500 http://dl.yarnpkg.com/debian stable/main amd64 Packages

Daniel15 avatar Nov 16 '16 07:11 Daniel15

Yarn creates MODULE_CACHE_DIRECTORY/.roadrunner.json, where MODULE_CACHE_DIRECTORY can be ~/.cache or ~/Library/Caches/Yarn depending on the system.

  • https://github.com/yarnpkg/yarn/blob/92399c4b323ce8033685b170f74a566e7879a266/src/constants.js#L55
  • and https://github.com/yarnpkg/yarn/blob/553e55f146a465a4e773b53b0a93752163c4b039/bin/yarn.js#L12

I think either yarn should use temporary directory for roadrunner or read config file to get cache directory. I'm having the same problem while setting --cache-folder, e.g.

$ yarn install --cache-folder ./tmp/yarn-cache

Zhomart avatar Nov 17 '16 02:11 Zhomart

Mac OSX fix: mkdir -p ~/Library/Caches/Yarn

ghost avatar Nov 17 '16 03:11 ghost

Hi @msmfsd How to fix it, if the yarn was installed through nvm npm -g -i yarn?

wellyshen avatar Nov 17 '16 09:11 wellyshen

@wellyshen nvm clear-cache

ghost avatar Nov 17 '16 09:11 ghost

Fixed via #1902.

wyze avatar Nov 17 '16 13:11 wyze

Hi @wyze The problem still exist, I install the yarn through nvm (npm -i -g yarn) and I also clear cache as @MoeSattler mentioned before running yarn --version, and the error occurs:

2016-11-17 11 09 16

Now, I install back to the v0.16.1, and it works... I wish the v0.17 version could also works for me

wellyshen avatar Nov 17 '16 15:11 wellyshen