node_modules is missing after successful yarn install

yarn install exits successfully, but node_modules does not exist.

Repro steps

  1. Clone https://github.com/nickheiner/camelot-web/tree/b6e1924a1aeb611ec4fc9e21d97597d6451234c5.
位 yarn install --verbose
yarn install v1.5.1
verbose 0.471 Checking for configuration file "/Users/nickheiner/Code/camelot-web/.npmrc".
verbose 0.471 Checking for configuration file "/Users/nickheiner/.npmrc".
verbose 0.471 Found configuration file "/Users/nickheiner/.npmrc".
verbose 0.472 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.472 Checking for configuration file "/Users/nickheiner/Code/camelot-web/.npmrc".
verbose 0.472 Checking for configuration file "/Users/nickheiner/Code/.npmrc".
verbose 0.472 Checking for configuration file "/Users/nickheiner/.npmrc".
verbose 0.472 Found configuration file "/Users/nickheiner/.npmrc".
verbose 0.473 Checking for configuration file "/Users/.npmrc".
verbose 0.475 Checking for configuration file "/Users/nickheiner/Code/camelot-web/.yarnrc".
verbose 0.475 Checking for configuration file "/Users/nickheiner/.yarnrc".
verbose 0.475 Found configuration file "/Users/nickheiner/.yarnrc".
verbose 0.476 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.476 Checking for configuration file "/Users/nickheiner/Code/camelot-web/.yarnrc".
verbose 0.476 Checking for configuration file "/Users/nickheiner/Code/.yarnrc".
verbose 0.476 Checking for configuration file "/Users/nickheiner/.yarnrc".
verbose 0.476 Found configuration file "/Users/nickheiner/.yarnrc".
verbose 0.477 Checking for configuration file "/Users/.yarnrc".
verbose 0.48 current time: 2018-03-10T22:32:40.308Z
[1/4] 馃攳  Resolving packages...
[2/4] 馃殮  Fetching packages...
[##################################################################################################################################################################################################################################-] 902/904

位 echo $?
0

Expected: node_modules exists
Actual:

位 ls node_modules
ls: node_modules: No such file or directory

It is odd that the final package counter says 902/904.

Workaround: Delete yarn.lock and regenerate it by running yarn again. This time, node_modules exists, but of course any state you were persisting in yarn.lock is gone.

Versions

位 yarn -v
1.5.1
位 node -v
v9.8.0

macOS 10.13.3

I also tried on yarn@v1.6.0-20180309.0951.

Author: Fantashit

1 thought on “node_modules is missing after successful yarn install

  1. I’m seeing similar behavior when running yarn in a docker build.

    [1/5] Validating package.json...
    [2/5] Resolving packages...
    [3/5] Fetching packages...
    There appears to be trouble with your network connection. Retrying...
    

    It never logs step 4 or 5, and it seems to exit with code 0 for some weird reason. This only seem to happen for certain installations, and occasionally it goes away? Can’t really give reproducable steps either because if the intermittent behavior (and our dependencies contains private packages)

Comments are closed.