craftcms / gatsby-source-craft

Gatsby source plugin for Craft CMS.
MIT License
54 stars 13 forks source link

Unable to source nodes! – no such file or directory ...internal-craft-fragments #80

Open sgtpenguin opened 2 years ago

sgtpenguin commented 2 years ago

Description

I can't get this to run. When I gatsby develop or gatsby-build I get the following error.

 ERROR 

Unable to source nodes!

 ERROR #11321  PLUGIN

"gatsby-source-craft" threw an error while running the createSchemaCustomization lifecycle:

ENOENT: no such file or directory, scandir
'/Users/dylan/Sites/wrkshp/node_modules/gatsby-source-craft/.cache/internal-craft-fragments'

I've tried with and without the fragmentsDir option, however that option seems to have no effect.

I have the Gatsby Helper plugin installed. Craft is the current version. "gatsby": "^4.0.2",

Any ideas?

sgtpenguin commented 2 years ago

Update: I created the missing directory manually in node_modules just to see if that would work and it does get me past that error.

Now I get this:



"gatsby-source-craft" threw an error while running the sourceNodes lifecycle:

Schema introspection failed. First error:

  45 | async function getSchema() {
  46 |     if (!schema) {
> 47 |         schema = await loadSchema(execute);
     |                  ^
  48 |     }
  49 |     return schema;
  50 | }

File: node_modules/gatsby-source-craft/gatsby-node.js:47:18```
metheeruetaichetcharoen-toast commented 2 years ago

@sgtpenguin Have you got this figure out? I just installed this and got the same error, even with older version of gatsby installed.

sgtpenguin commented 2 years ago

@metheeruetaichetcharoen-toast I have not figured it out unfortunately. Using gatsby-source-graphql instead.

metheeruetaichetcharoen-toast commented 2 years ago

@sgtpenguin Would you be able to use gatsby-source-graphql to set up a live preview mode? If so, do you have an example of how to do that?

sgtpenguin commented 2 years ago

I haven't attemped live preview yet, but I was able to easily trigger builds on save using https://github.com/craftcms/gatsby-helper and hosting with Gatsby Cloud using the Build Webhook Url.

That plugin also has a Preview Webhook Url setting so I don't see why it wouldn't work, but I just haven't tried it.

mmorkt commented 2 years ago

I'm getting the same error, just upgraded from Gatsby 3 to Gatsby 4.22.1 Everything works in develop but when running build the error comes and goes randomly, sometimes the build is successful other times it breaks. When running build some of the nodes are missing, but they work in develop.

 ERROR #11321  PLUGIN

"gatsby-source-craft" threw an error while running the createSchemaCustomization lifecycle:

ENOENT: no such file or directory, open '/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/.cache/internal-craft-fragments/designs_Category.graphql'
mmorkt commented 2 years ago

how do you handle images in gatsby-source-graphql seems like gatsby-plugin-image is not compatible and i guess you looses incremental builds.