Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Building a Gatsby site with Yarn 1.0 results in ton of importing errors #89

Closed
Aleksion opened this issue Oct 9, 2017 · 13 comments
Closed

Comments

@Aleksion
Copy link

Aleksion commented Oct 9, 2017

Hi,

I've been fighting a bit with getting GatsbyJS working on Netlify. The root issues is in gatsby: gatsbyjs/gatsby#2001 (comment)
Which is caused due to GatsbyJS using a global graphql. Meaning this isn't an error on your end.

As can be seen in the issue, the suggested solution is to use Yarn resolutions and force every yarn dependency to resolve to the same version.

However, I haven't been able to get Yarn 1.0 to run succesfully. Whenever I try to build it stumbles over a new missing dependency in the build flow:

screen shot 2017-10-09 at 22 59 46

screen shot 2017-10-09 at 22 59 56

screen shot 2017-10-09 at 23 00 10

screen shot 2017-10-09 at 23 00 21

screen shot 2017-10-09 at 23 00 32

screen shot 2017-10-09 at 23 00 46

UPDATE:
I've tried to reproduce it with a new starter gatsby project without luck. I'll keep digging on my end of things, but if you have any ideas I'm all ears

@fool
Copy link
Contributor

fool commented Oct 9, 2017

for our troubleshooting: similar report from another customer: https://app.intercom.io/a/apps/q245f50x/respond/inbox/1479299/conversations/12192293322

@fool
Copy link
Contributor

fool commented Oct 12, 2017

Netlify Support todo:

  • get a simpler reproduction case by:
    • create a site using workspaces with 1 dependency
    • add a second dependency in a subdir/package.json and confirm fail
    • build with a cleared cache and confirm success
    • update this bug (remove needs-review, update title + repro case)

@fool
Copy link
Contributor

fool commented Oct 17, 2017

We were unable to get a simpler example that we could try debugging to fail, @Aleksion - if you come up with a repro case that is less involved, let us know and we'll reopen this.

@fool fool closed this as completed Oct 17, 2017
@Aleksion
Copy link
Author

Sounds good. I'll dive into it the next time I hit it!

@jquense
Copy link

jquense commented Oct 31, 2017

arg this is a really magical bug :/ I can't manage to put a simpler repro together but this fails consistently on every gatsby netlify deploy when we try with workspaces. Myself and @KyleAMathews independently confirm it does not occur running the docker image locally, or in any other context except for an actual deploy. We've tried changing the versions of node and yarn to no effect and i see no information about this error anywhere:

https://app.netlify.com/sites/using-wordpress/deploys/59f8d06ddf995350b4b3712a

@fool
Copy link
Contributor

fool commented Oct 31, 2017 via email

@jquense
Copy link

jquense commented Nov 1, 2017

As is usually the case, just after posting I figures it out. The problem is that the default YARN_FLAGS ignores optional deps which for some reason doesn't play nice with workspaces with some packages with post install scripts. Still not sure why I can't reproduce the issue with docker locally tho

@fool
Copy link
Contributor

fool commented Nov 1, 2017 via email

@jquense
Copy link

jquense commented Nov 1, 2017

I am not sure why --ignore-optional doesn't work in some cases, but it doesn't seem safe as a default. Clearing that, fixed the problem.

As an aside I do think better defaults for YARN_FLAGS should include --pure-lockfile or --frozen-lockfile Yarn recommends --frozen-lockfile for CI builds but it's a bit opinionated

@fool fool reopened this Nov 2, 2017
@oskarrough
Copy link

Can confirm that setting YARN_FLAGS='--no-ignore-optional solves it.

I get the error when YARN_VERSION is set and node-sass is used. I assume it's something with node-sass's postinstall hook + optional dependencies?

Can we change the defaults ala what @jquense suggests and maybe finally update the default Yarn version as well? :) #122

@brycekahle
Copy link
Contributor

Yarn finally updated in #130. I'll close this issue when the new image has been deployed.

@Bouncey
Copy link

Bouncey commented Feb 14, 2018

I'm guessing the new image was deployed within the last 24 hours? Our CSS just broke on a gatsby site

@brycekahle
Copy link
Contributor

Yes, my apologies. We deployed yesterday afternoon. @Bouncey if you reach out to support, they can help solve your problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants