Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn offline mirror behavior is very strange #3194

Closed
agibralter opened this issue Apr 19, 2017 · 9 comments
Closed

yarn offline mirror behavior is very strange #3194

agibralter opened this issue Apr 19, 2017 · 9 comments
Labels

Comments

@agibralter
Copy link

setup

I am using yarn@0.22.0. I am using node v7.9.0 installed with nvm on macOS 10.12.4. yarn is installed as npm install -g yarn@0.22.0. I have also tried brew install yarn.

This is my repo's .yarnrc:

$ cat .yarnrc
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

yarn-offline-mirror "./vendor/npm_cache"

bug

It seems that using yarn@0.22.0 does not consistently record the right value for "resolved" in the yarn.lock file (down to 0.19.x and up to 0.23.x also seem to have the same strange behavior).

The only way I can get yarn to consistently record something like this:

react@^15.4.2:
  version "15.5.4"
  resolved react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047
  dependencies:
    fbjs "^0.8.9"
    loose-envify "^1.1.0"
    object-assign "^4.1.0"
    prop-types "^15.5.7"

...rather than, e.g., resolved "https://registry.yarnpkg.com/react/-/react-15.4.2.tgz#41f7991b26185392ba9bae96c8889e7e018397ef"

is to run something like rm -rf vendor/npm_cache/ node_modules/ yarn.lock; yarn cache clean; yarn. If I don't yarn cache clean, I can end up with urls instead of .tgz references. This behavior is pretty frustrating because I don't consistently get offline mirror versions specified in my yarn.lock.

If you have an offline mirror set up, should it be expected that you'll never see a registry.yarnpkg.com in the yarn.lock file, right?

@kmmolex
Copy link

kmmolex commented Apr 19, 2017

I'm experiencing the same issue. I had the correct results in offline mode yesterday. Are you always able to get offline mirrors after using yarn cache clean? I'm still getting https://registry.yarnpkg.com

@agibralter
Copy link
Author

@kmmolex hmm I only get the correct results when I blow away yarn.lock, clean the cache, an "re-yarn." Step-wise yarn-ing does not seem to exhibit consistently reliable behavior for me. I almost always re-yarn from scratch and look at the git diff. 😦

@griffinmichl
Copy link

I am also seeing this problem in fact, it breaks yarn-offline-mirror-pruning because if the install points to https://registry.yarnpkg.com, the value in the name in the offline mirror does not equal the name in the lockfile and yarn deletes necessary packaged from your offline cache.

@bestander
Copy link
Member

cc @arcanis

@jakewisse
Copy link

If you have an offline mirror set up, should it be expected that you'll never see a registry.yarnpkg.com in the yarn.lock file, right?

Going through the steps outlined in Running Yarn offline, I think not. My yarn.lock has resolved fields pointing at registry.yarnpkg.com, yet after running yarn cache clean, rm -rf node_modules, and disconnecting all network connections, I'm still able to reinstall from the offline mirror.

@arcanis
Copy link
Member

arcanis commented May 2, 2017

This issue shouldn't be relevant anymore starting from 0.23, since we now always use expanded registry urls.

@griffinmichl
Copy link

@arcanis I do not believe that is the case in 0.23. Did you mean 0.24?

@griffinmichl
Copy link

Nevermind. I was on the wrong nvm version.

@agibralter
Copy link
Author

I think we can close this ticket... the issue is actually this one: #3154 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants