question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing yarn.lock from the init repo breaks Yarn installs

See original GitHub issue

Description

The following commit removed the yarn.lock from gatsby-starter-default:

https://github.com/gatsbyjs/gatsby-starter-default/commit/a5368fa2bfe1afa1b50ad27e7ad35eaa36b191f8#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de

As a result, the init script now goes through the following codepath:

https://github.com/gatsbyjs/gatsby/blob/b22384cc2cf297aa969f16bd8faee11cee5f79e8/packages/gatsby-cli/src/init-starter.ts#L113-L119

The yarn import command has been deprecated / removed in Yarn 2, and crashes.

Steps to reproduce

cd $(mktemp -d)
yarn init -2 -w
yarn dlx gatsby new my-gatsby

Expected result

Works

Actual result

Breaks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ascorbiccommented, Nov 24, 2020

My understanding was that we were only removing it from the minimal starter because it was targetting a canary, and with that we were removing both lockfiles. I don’t know why we’d remove it from others.

1reaction
merceyzcommented, Nov 24, 2020

If that’s the case shouldn’t package-lock.json have been deleted as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yarn install does not install missing modules in node_modules
My guess is that node_modules/.yarn-integrity is doing something here, such that if you update yarn.lock it'll notice things are out of sync. It ......
Read more >
yarn.lock
During install, Yarn will only use the top-level yarn.lock file and will ignore any yarn.lock files that exist within dependencies. The top-level yarn.lock...
Read more >
Should I commit the yarn.lock file and what is it for?
Yarn resolves these issues around versioning and non-determinism by using lock files and an install algorithm that is deterministic and reliable ...
Read more >
Yarn lock: how it works and what you risk without maintaining ...
Answer: Well, yarn will, of course, install dependencies freshly added to package.json that are not yet installed and/or not present in yarn.
Read more >
Advanced package manager features for npm, Yarn, and pnpm
If you add, update, or remove dependencies, you have to run yarn install , of course, to update yarn.lock , .pnp.cjs , and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found