gatsby-source-craft icon indicating copy to clipboard operation
gatsby-source-craft copied to clipboard

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

Open sgtpenguin opened this issue 2 years ago • 7 comments

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 avatar Jul 08 '22 15:07 sgtpenguin

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```

sgtpenguin avatar Jul 08 '22 16:07 sgtpenguin

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

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

sgtpenguin avatar Aug 11 '22 20:08 sgtpenguin

@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?

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.

sgtpenguin avatar Aug 11 '22 21:08 sgtpenguin

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 avatar Sep 09 '22 11:09 mmorkt

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

mmorkt avatar Sep 12 '22 06:09 mmorkt