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.lock file changing due to non-deterministic generation while adding dependency #2477

Closed
ertrzyiks opened this issue Jan 17, 2017 · 4 comments

Comments

@ertrzyiks
Copy link

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

What is the current behavior?
The yarn.lock file has unrelated changes when adding a new dependency. Mostly they seem to be ordering differences. It has been reported once for cases when we just install new dependencies.
in #1168

The discussion about it still being a problem when using yarn add starts here: #1168 (comment)

To be clear, I experience this issue even for package with no dependencies and no other packages depend on it like this: https://github.com/ertrzyiks/test-package.

The diff is full of things like:

-accepts@~1.3.3, [email protected]:
+[email protected], accepts@~1.3.3:

or

+ansi-regex@2, ansi-regex@^2.0.0:
+  version "2.0.0"
+  resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"
+
ansi-regex@^0.2.0, ansi-regex@^0.2.1:
  version "0.2.1"
  resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9"
- 
-ansi-regex@^2.0.0, ansi-regex@2:
-  version "2.0.0"
-  resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"

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

  • Check yarn.lock file into source repository.
  • Some time later add a new dependency
  • Diff of lock file is full of unrelated changes

What is the expected behavior?
Add a lock entry for new dependency

Please mention your node.js, yarn and operating system version.
yarn 0.17.10
yarn 0.18.1
yarn 0.19.1
node 6.9.1
OSX 10.11.5

@bestander
Copy link
Member

That is odd, I was sure we fixed it in 0.17 https://github.com/yarnpkg/yarn/blob/master/src/lockfile/stringify.js#L77

@ertrzyiks
Copy link
Author

@bestander so it would be possible if old lock is generated by v0.16? and then when adding a new package with v0.17 it is normal to have such diff?

@bestander
Copy link
Member

bestander commented Jan 17, 2017

Yeah, if the lockfile is old, then 0.17 version would rewrite it once and should not do change it anymore

@ertrzyiks
Copy link
Author

Ok, all subsequent installs produce pretty diff 👍 so, I guess it's not a problem

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

2 participants