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.

Gatsby depends on gatsby-link implicitly

See original GitHub issue

I’m new to Gatsby and experimenting with migrating a single page site to it. Because I only need a single page I have no need for gatsby-link. However, after removing the package (which was included by the default gatsby new starter) I get the following error:

 ERROR  Failed to compile with 1 errors          9:21:45 AM

This dependency was not found:

* gatsby-link in ./.cache/dev-404-page.js

To install it, you can run: npm install --save gatsby-link

It’s clear to me that Gatsby’s internal development 404 page relies on gatsby-link so I should keep it in my own package.json. However, I found it surprising that gatsby-link isn’t just included in the gatsby package because it seems that every single Gatsby project will use this in development. Alternatively, gatsby-link could be listed as a peerDependency in package.json, giving users a hint to include it manually, or the 404 page could be rewritten to not use the plugin. Another idea is that this could be an internal plugin with the Link component exported somewhere in the gatsby module or a submodule like gatsby/link, leading to a similar developer experience but without the extra npm package.

To be clear, I’m specifically referring to the cyclical dependency between the gatsby and gatsby-link packages and the developer experience around using the gatsby package without any dependent packages. I’m not necessarily suggesting that Gatsby should force users to use gatsby-link by default, I like that this functionality is more explicitly provided in a separate package.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
KyleAMathewscommented, Nov 29, 2017

Agreed — it should have always been part of gatsby. As part of v2 we’ll be combining the two.

0reactions
timm50commented, Apr 13, 2018

I have the same problem:

ERROR Failed to compile with 1 errors
This dependency was not found:

  • gatsby-link in ./.cache/dev-404-page.js To install it, you can run: npm install --save gatsby-link

the trouble with me is I’m newer than you guys and I don’t understand what you did to fix the problem? I’ve tried npm install --save gatsby-link and npm install -g gatsby link. I’ve installed a bunch of webpack stuff. I keep getting the same error?

I can’t understand from above, how you fixed it?

Also my dependencies looks like this so I have gatsby-link: “dependencies”: { “babel-plugin-styled-components”: “^1.5.1”, “gatsby”: “^1.9.247”, “gatsby-link”: “^1.6.40”, “gatsby-plugin-react-helmet”: “^2.0.10”, “gatsby-plugin-styled-components”: “^2.0.11”, “react-helmet”: “^5.2.0”, “styled-components”: “^3.2.5”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Link API
Gatsby's Link component extends the Link component from Reach Router to add useful enhancements specific to Gatsby. The to , replace , ref...
Read more >
Gatsby and his class dream - DiVA Portal
The link between Gatsby's dream and the American dream descended from immigrants, is supported by a quote from Nick in the end of...
Read more >
The Great Gatsby - Thomas Deacon Academy
In The Great Gatsby's nine chapters, Fitzgerald presents the rise and fall of Jay Gatsby, as related in a first-person narrative by Nick...
Read more >
Implying Authors in "The Great Gatsby" - JSTOR
narrative effect depend on whether the narrator is dramatized in his own ... in Gatsby, we will need to grapple with an implied...
Read more >
Individual Responsibility in the Great Gatsby | VQR Online
When Nick Carraway, narrator of The Great Gatsby, recognizes that his woman ... her happiness depended on her having a relationship with a...
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