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 installs wrong version of GitHub dependency #7418

Open
LinusU opened this issue Jul 19, 2019 · 3 comments
Open

Yarn installs wrong version of GitHub dependency #7418

LinusU opened this issue Jul 19, 2019 · 3 comments

Comments

@LinusU
Copy link

LinusU commented Jul 19, 2019

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Running yarn add against a GitHub dependency correctly installs the specified branch/commit of that dependency. But when using yarn install to get the dependency again (e.g. on new machine or after cleaning node_modules), the wrong version is installed.

If the current behavior is a bug, please provide the steps to reproduce.

$ echo {} > package.json

$ yarn add LinusU/react-native-popup-dialog#rn-modal 
✨  Done in 1.31s.

$ shasum -a 256 node_modules/react-native-popup-dialog/dist/PopupDialog.js
38143348b4c9e5ac42d67d6e5ce89c764968d073e9565fd453dccce9795c1920

$ rm -rf node_modules
$ yarn
✨  Done in 0.87s.

$ shasum -a 256 node_modules/react-native-popup-dialog/dist/PopupDialog.js
e04749ea0bbeb8d07b11f7f8279fdfe00a568b9625a538e04590b5ced4844323

As we can see, the first call to yarn add correctly installs the branch rn-modal from GitHub. However, when cleaning out node_modules and installing again, it takes the version from npm instead.

This is the relevant parts from package.json and yarn.lock:

  "dependencies": {
    "react-native-popup-dialog": "LinusU/react-native-popup-dialog#rn-modal"
  }
react-native-popup-dialog@LinusU/react-native-popup-dialog#rn-modal:
  version "0.18.3"
  resolved "https://codeload.github.com/LinusU/react-native-popup-dialog/tar.gz/be1b91574ac1314ae9ab4f250598d713fff0e89a"
  dependencies:
    babel-plugin-flow-react-proptypes "^9.1.1"
    prop-types "^15.6.0"

What is the expected behavior?

I expected the exact same package to be installed both times.

Please mention your node.js, yarn and operating system version.

$ node --version
v12.6.0

$ yarn --version
1.17.3

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.5
BuildVersion:	18F203
@LinusU LinusU changed the title Yarn installs wrong version of GitHub Yarn installs wrong version of GitHub dependency Jul 19, 2019
@dword-design
Copy link

dword-design commented Dec 26, 2019

Yeah same problem for me here. Seems to be related to branches, because on default branches it works as expected. And Yarn always seems to be checking out the first commit on the branch. After yarn upgrade it's the newest version again, but this really isn't the solution ^^.

@dword-design
Copy link

dword-design commented Dec 26, 2019

@LinusU Some more investigation: Clearing the Yarn cache seems to fix the issue because Yarn takes some old version of the package:

yarn cache clean [module-name]

That's at least a temporary solution until it is fixed.

@jtomaszewski
Copy link

Seems similar to #4734 .

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

No branches or pull requests

3 participants