Yarn: Not creating `yarn.lock` on `yarn install`

Created on 23 Apr 2018  路  4Comments  路  Source: yarnpkg/yarn

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

What is the current behavior?
yarn install isn't producing a yarn.lock, thus preventing yarn upgrade

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

  • npx create-react-app my-app
  • cd my-app
  • yarn install
  • yarn upgrade

image

What is the expected behavior?
yarn.lock created when running yarn install

Please mention your node.js, yarn and operating system version.
node: v8.11.1
yarn: 1.6.0
OS: macOS Sierra v10.12.6

triaged

Most helpful comment

Another option is to create an empty lock-file before running yarn install.

All 4 comments

I ran into this as well. Right after running yarn install, I don't have a yarn.lock file and I get errors when running commands that need it.

-> yarn why chalk
yarn why v1.5.1
error An unexpected error occurred: "No lockfile in this directory. Run `yarn install` to generate one.".
info If you think this is a bug, please open a bug report with the information provided in ".../yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/why for documentation about this command.

For those who are still stuck on this, running yarn add (for any package) _will_ add the lockfile.

Another option is to create an empty lock-file before running yarn install.

I tried various suggestions with no luck. Then I did this:

rm -rf node_modules <-- blows away your entire node_modules directory
yarn install

A nice, fresh yarn.lock file was the result.

Was this page helpful?
0 / 5 - 0 ratings