Yarn: Lock files generated by `yarn install` and `yarn generate-lock-entry` are different

Created on 26 Dec 2016  ·  7Comments  ·  Source: yarnpkg/yarn

Yarn version
0.18.1

Do you want to request a feature or report a bug?
Bug (not sure)

What is the current behavior?
Given a same package.json, lock files generated by yarn install and yarn generate-lock-entry are different

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

{
  "name": "test-yarn-generate-lock-entry",
  "version": "1.0.0",
  "dependencies": {
    "bunyan": "1.8.3",
    "js-yaml": "3.7.0",
    "lodash": "4.16.4",
    "node-shell-parser": "0.2.1",
    "restify": "4.1.1",
    "ws": "1.1.1"
  }
}

yarn install produces:

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


argparse@^1.0.7:
  version "1.0.9"
  resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
  dependencies:
    sprintf-js "~1.0.2"

[email protected]:
  version "0.1.11"
  resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.1.11.tgz#559be18376d08a4ec4dbe80877d27818639b2df7"

assert-plus@^0.1.5:
  version "0.1.5"
  resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.1.5.tgz#ee74009413002d84cec7219c6ac811812e723160"

assert-plus@^1.0.0:
  version "1.0.0"
  resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"

backoff@^2.4.0:
  version "2.5.0"
  resolved "https://registry.yarnpkg.com/backoff/-/backoff-2.5.0.tgz#f616eda9d3e4b66b8ca7fca79f695722c5f8e26f"
  dependencies:
    precond "0.2"

...

yarn generate-lock-entry produces:

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


[email protected]:
  version "1.0.0"
  dependencies:
    bunyan "1.8.3"
    js-yaml "3.7.0"
    lodash "4.16.4"
    node-shell-parser "0.2.1"
    restify "4.1.1"
    ws "1.1.1"

What is the expected behavior?
yarn install and yarn generate-lock-entry produce the same yarn.lock file. Or provide documentation on how to produce the same yarn.lock file

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

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.12.2 (16C68)
      Kernel Version: Darwin 16.3.0

$ uname -a
Darwin Yosemite.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64

$ node --version
v7.2.1

$ yarn --version
0.18.1

Most helpful comment

Any updates for this?

All 7 comments

I also had expected that the two commands would produce the same yarn.lock

@kittens Could you clarify if this is expected behaviour?

I ran into an issue that appears to be caused by this yarn.lock file format difference. The version that is created by yarn generate-lock-entry causes yarn install --prefer-offline to fail...

example:

```bash
error Couldn’t find package “babel-polyfill” on the “npm” registry.
````

So I'm forced to use the file generated by yarn install. This feels like a bug.

December 2017, yarn install and yarn generate-lock-entry still do not generate the same package.lock file :-(

Any news on this? This ideal to run it on the CI

I'm writing tooling around yarn and was looking for the equivalent to npm install --package-lock-only. Would love an update on this issue as well, since my run of yarn generate-lock-entry didn't even yield a dependencies section in yarn.lock.

Any updates for this?

Was this page helpful?
0 / 5 - 0 ratings