Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Cannot find module './third-party/gatsby-node' #217

Open
joeweale opened this issue May 28, 2020 · 76 comments
Open

Cannot find module './third-party/gatsby-node' #217

joeweale opened this issue May 28, 2020 · 76 comments

Comments

@joeweale
Copy link

Getting an error on build;

Error in "C:...\node_modules\gatsby-source-prismic-graphql\gatsby-node.js": Cannot find module './third-party/gatsby-node'

Any ideas?

Thanks

Joe

@aodysseos
Copy link

I've been getting the same since yesterday and is been blocking a project from going live!

Nightmare @joeweale !!!

Any thought will be great!

Thanks

@AndrejGajdos
Copy link

I have the same issue

@aodysseos
Copy link

Potentially falling back to "gatsby-source-graphql-universal": "3.3.0" could fix the issue. I've tried it on a new project and it work. I'm now applying it on my project. Fingers crossed!

@AndrejGajdos
Copy link

AndrejGajdos commented May 28, 2020

@aodysseos I tried gatsby-source-prismic-graphql 3.6.2, 3.5.0, 3.3.0 and I still get the same error.

edit:// I am not using gatsby-source-graphql-universal, only gatsby-source-prismic-graphql

@aodysseos
Copy link

@AndrejGajdos I have:

  • "gatsby": "^2.21.37",
  • "gatsby-source-prismic-graphql": "^3.6.2",
  • "gatsby-source-graphql-universal": "3.3.0"

and running node v10.13.0

If that helps

@AndrejGajdos
Copy link

AndrejGajdos commented May 28, 2020

@aodysseos thanks I checked my package.json and I don't use gatsby-source-graphql-universal. I use only gatsby-source-prismic-graphql. I tried gatsby-source-prismic-graphql three different versions 3.6.2, 3.5.0, 3.3.0 and it didn't help.

I tried to add "gatsby-source-graphql-universal": "3.3.0" dependency and it didn't solve the issue.

Do you mean changing gatsby-source-graphql-universal inside gatsby-source-prismic-graphql?

@NSpehler
Copy link

Same problem here...

@jodiedoubleday
Copy link

Yep this seem to have started happening this morning

@NSpehler
Copy link

Seems related to this commit: birkir/gatsby-source-graphql-universal@f349162

@aodysseos
Copy link

aodysseos commented May 28, 2020

So I managed to work around it for now by using the following in my package.json

  • "gatsby": "^2.21.37",
  • "gatsby-source-graphql-universal": "3.3.0",
  • "gatsby-source-prismic-graphql": "3.4.0-beta.1"

It seems that gatsby-source-prismic-graphql installs the latest version of gatsby-source-graphql-universal as a dependancy which has the issue. By forcing a specific version and using a previous version of gatsby-source-prismic-graphql I got around the problem for now and got my project to build.

NOTE: gatsby-source-graphql-universal was updated 20hrs ago so I'm guessing that caused it.

Hope that helps

@NSpehler
Copy link

@aodysseos The exact same configuration didn't fix it for me.

@riccoski
Copy link

I've got it working by installing: "gatsby-source-graphql-universal": "3.3.0",
and removing "gatsby-source-graphql-universal" from node_modules/gatsby-source-prismic/node_modules.

It still installs 3.4.0 in there

@zpthree
Copy link

zpthree commented May 28, 2020

I got it working by deleting node_modules, adding a yarn dependency resolution to my package.json, and reinstalling with yarn. Hopefully this issue gets fixed soon.

"resolutions": { "gatsby-source-graphql-universal": "3.3.0" },

@codebravotech
Copy link

codebravotech commented May 29, 2020

Same issue!

Edit: locking the dependency using a resolutions block as per zpthree's suggestion is the correct workaround.

@botre
Copy link

botre commented May 29, 2020

Same issue using Windows 10, unfortunately I don't use Yarn so the resolution workaround isn't available to me.

@mrseanbaines
Copy link

Filed an issue with Gatsby before finding out this package wasn't maintained by them. Here's my report with a few extra details and an example site:

Description

Following setup instructions from various sources (e.g. here), gatsby-source-prismic-graphql throws the following error:

Error: Cannot find module './third-party/gatsby-node'
Require stack:
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby-source-graphql-universal/gatsby-node.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby-source-prismic-graphql/gatsby-node.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bootstrap/index.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/commands/develop.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby-cli/lib/create-cli.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby-cli/lib/index.js
- /Users/mrseanbaines/projects/gatsby-prismic-blog/node_modules/gatsby/dist/bin/gatsby.js

Steps to reproduce

npx gatsby new gatsby-prismic-blog
cd gatsby-prismic-blog
yarn add gatsby-source-prismic-graphql prismic-javascript prismic-reactjs
yarn start

Minimal Reproduction: https://github.com/mrseanbaines/gatsby-prismic-blog

Expected result

Start local dev server without error.

Actual result

Error throws when starting local dev server.

Environment

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 83.0.4103.61
    Firefox: 76.0.1
    Safari: 13.1
  npmPackages:
    gatsby: ^2.21.37 => 2.21.37 
    gatsby-image: ^2.4.4 => 2.4.4 
    gatsby-plugin-manifest: ^2.4.5 => 2.4.5 
    gatsby-plugin-offline: ^3.2.3 => 3.2.3 
    gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1 
    gatsby-plugin-sharp: ^2.6.4 => 2.6.4 
    gatsby-source-filesystem: ^2.3.4 => 2.3.4 
    gatsby-source-prismic-graphql: ^3.6.2 => 3.6.2 
    gatsby-transformer-sharp: ^2.5.2 => 2.5.2 

@miraclemaker
Copy link

I ran into the same issue when updating my packages and solved it by reverting back to the following versions:
"gatsby": "^2.20.19",
"gatsby-plugin-sharp": "^2.5.4",
"gatsby-source-filesystem": "^2.2.2",
"gatsby-source-prismic-graphql": "^3.6.2",
"gatsby-transformer-sharp": "^2.4.4",

All of these may not be required but I didn't have any more time to spend on it.

@benwalio
Copy link

benwalio commented May 29, 2020

running into the exact same issue here.

gatsby info

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-1060NG7 CPU @ 1.20GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.0.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Firefox: 76.0.1
    Safari: 13.1
  npmPackages:
    gatsby: ^2.22.12 => 2.22.12
    gatsby-image: ^2.4.4 => 2.4.5
    gatsby-plugin-manifest: ^2.4.5 => 2.4.5
    gatsby-plugin-offline: ^3.2.3 => 3.2.3
    gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1
    gatsby-plugin-sharp: ^2.6.4 => 2.6.4
    gatsby-source-filesystem: ^2.3.4 => 2.3.8
    gatsby-source-prismic-graphql: ^3.6.2 => 3.6.2
    gatsby-transformer-sharp: ^2.5.2 => 2.5.2
  npmGlobalPackages:
    gatsby-cli: 2.12.37

@AndrejGajdos
Copy link

@zpthree Thanks for the fix, I didn't know yarn has such a nice feature.

@subhashb
Copy link

subhashb commented Jun 1, 2020

Just adding more information why this issue cropped up.

I hacked my way through this issue by force-creating the gatsby-node.js in the right folder, and it works for development.

Steps:

  • Locate gatsby-source-graphql-universal in your node_modules
  • Create a folder called third-party in the folder
  • Copy this gatsby-node.js file into the folder

This won't work for production, of course. This is the commit that broke the setup. The reason is that the new third-party folder was not included in packaging.

I just created a new issue on that repo.

@RectoVersoDev
Copy link

Same problem here 😥

@joshua-isaac
Copy link

I'm getting the same problem, hopefully this issue can get resolved 🙏🏽

@olonade43
Copy link

olonade43 commented Jun 2, 2020

Reverting is working for me locally but still breaks for me during deploys to production. Anyone else running into that?

@TatsumiSuenaga
Copy link

TatsumiSuenaga commented Jun 2, 2020

@aodysseos

So I managed to work around it for now by using the following in my package.json

  • "gatsby": "^2.21.37",
  • "gatsby-source-graphql-universal": "3.3.0",
  • "gatsby-source-prismic-graphql": "3.4.0-beta.1"

It seems that gatsby-source-prismic-graphql installs the latest version of gatsby-source-graphql-universal as a dependancy which has the issue. By forcing a specific version and using a previous version of gatsby-source-prismic-graphql I got around the problem for now and got my project to build.

NOTE: gatsby-source-graphql-universal was updated 20hrs ago so I'm guessing that caused it.

Hope that helps

Thanks! This worked for me after I cleared my ./node_modules/

EDIT:
Nevermind, build fails in prod/staging

@Bram-Zijp
Copy link

This should work fine as quick and dirty temp workaround

@mbbillz
Copy link

mbbillz commented Jun 3, 2020

Same issue...

@iamsainikhil
Copy link

iamsainikhil commented Jun 5, 2020

Resolutions can be added in NPM similar to Yarn using this package -> https://github.com/rogeriochaves/npm-force-resolutions

  1. Add the below preinstall script in package.json
"scripts": {
  "preinstall": "npx npm-force-resolutions"
}
  1. Add the gatsby-source-graphql-universal in resolutions
"resolutions": { 
   "gatsby-source-graphql-universal": "3.3.0" 
}
  1. Run the npm install

@noblica
Copy link
Contributor

noblica commented Jun 9, 2020

Yup, same issue here. Hopefully it gets fixed soon.

@tynsoltys
Copy link

The one day I find some time to muck around with prismic this happens, of course.

@necheporenko
Copy link

The same issue :(

System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files\nodejs\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.8.2 - /c/Users/User/AppData/Local/Programs/Python/Python38-32/python
Browsers:
Edge: 44.18362.449.0
npmPackages:
gatsby: ^2.23.11 => 2.23.11
gatsby-image: ^2.4.9 => 2.4.9
gatsby-plugin-catch-links: ^2.3.7 => 2.3.7
gatsby-plugin-google-analytics: ^2.3.6 => 2.3.6
gatsby-plugin-lodash: ^3.3.6 => 3.3.6
gatsby-plugin-manifest: ^2.4.14 => 2.4.14
gatsby-plugin-netlify: ^2.3.7 => 2.3.7
gatsby-plugin-react-helmet: ^3.3.6 => 3.3.6
gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
gatsby-plugin-sass: ^2.3.6 => 2.3.6
gatsby-plugin-sharp: ^2.6.14 => 2.6.14
gatsby-plugin-sitemap: ^2.4.7 => 2.4.7
gatsby-remark-autolink-headers: ^2.3.7 => 2.3.7
gatsby-remark-copy-linked-files: ^2.3.7 => 2.3.7
gatsby-remark-images: ^3.3.13 => 3.3.13
gatsby-remark-relative-images: ^0.3.0 => 0.3.0
gatsby-source-filesystem: ^2.3.14 => 2.3.14
gatsby-source-graphql-universal: ^3.4.0 => 3.4.0
gatsby-source-prismic-graphql: ^3.6.2 => 3.6.2
gatsby-transformer-remark: ^2.8.19 => 2.8.19
gatsby-transformer-sharp: ^2.5.7 => 2.5.7
npmGlobalPackages:
gatsby-cli: 2.12.24

@Bram-Zijp
Copy link

Bram-Zijp commented Jun 25, 2020

I just made my website dynamic and the only issue I had is solved by the comment from @chrisworman-pela in issue #196. Id recommend to take either my versions and workaround as approach or supply is with a minimal viable product that reproduces your error. Everything is golden for me and I am willing to dive into what ever is going wrong at your guys side.

Edit:
I'm pretty confident that most of your problems would be there with or without these updates.

@raleigh9123
Copy link

raleigh9123 commented Jun 26, 2020

I am having this same problem running the prismic.io tutorial STEP-BY-STEP from their website. So I'm using a fresh installation on a dummy/starter project (Installing cleanly from the tutorial setup instructions at https://prismic.io/docs/gatsby/getting-started-tutorials/launching-the-project), receiving the same error. I would list all the details of my environment, but I doubt I have a configuration too much different from those listed above.

I tried different versions of "gatsby-source-graphql-universal", "gatsby-source-prismic-graphql", and "gatsby". None of the solutions in this thread worked for me.

Original issue was posted 29 days ago, so I guess I'm not learning/using prismic.. which sucks because it looks great.

@amitava82
Copy link

I'm with @raleigh9123 on this. Just exploring prismic as solution to our platfrom but if this basic problem isn't resolved since 29 days I don't think it gives us much confidence to the product and support.

@steoneill
Copy link

@amitava82 The main thing is, the plugin isn't first party, it's an amazing plugin when it works, but understandably people in open source. I feel a bit sorry for the author of this plugin that prismic have co-opted it like they have.

@amitava82
Copy link

Yeah sorry I didn't realize it isn't first party plugin. When I saw this on prismic documentation I assumed so. Seems like prismic trying to piggyback on a 3rd party plugin without supporting original author.

@Bram-Zijp
Copy link

Bram-Zijp commented Jun 26, 2020

I am working on a working MVP which will soon contain the code you need. I did notice my previews started to break while my production app is working as a charm. I am guessing an dependency updated.

Edit 1:
I see that my preview app build and deployed 20 hours ago with the same lock file as i have locally works with preview. Locally it doesn't. Now trying to erase the chance the port in the url has something to do with it by altering my host file and redeploying my preview. Besides the url it could also be a platform issue. My preview runs on Linux and my local runs on Windows.

Edit 2: my redeploy of my linux preview works as a charm still. Now gonna try remove every type of cache and run the project locally on my macbook.

Edit 3:
My macbook shows previews like a charm too. Just pushed the changes which i will now test on my Macbook.

Edit 4:
My example project shows same signs as mentioned above by other people. My private project works as a charm on my Macbook. Weirdness. TBC

Edit 5:
My re-deploy through CI/CD from edit 2 with absolute no caching at all works like a charm also.

Edit 6:
Found the solution. It's a dependency mismatch of sorts. I copied my yarn.lock file from my working project onto my breaking project and it started to work on my macbook. Will have a working solution in a bit 😄

@Bram-Zijp
Copy link

Bram-Zijp commented Jun 26, 2020

It works 🥳

I created a working project that runs previews like a charm on Unix machines. The issue I didn't face but others did is sourced from a dependency that updated somewhere. After I added my working yarn.lock deps to the example project the Loading (StaticQuery) went away (@ole3021 @morszczuk @rowin1125 @stephenhendry).

You can find the project here: https://github.com/Bram-Zijp/gatsby-prismic-graphql-working-example

Edit 1:
If you have time to look into what dependency changed and breaks the previews/static queries, please post a reply stating you will and keep us updated wether you making progress or plans on finishing the hunt any time soon change.

Edit 2:
Find difference in the yarn.lock file here: https://github.com/Bram-Zijp/gatsby-prismic-graphql-working-example/commit/1fffb852d87c80c9bfaead855e480d32e2325da2 Edit: 3000 LOC 😨

Edit 3:
it seemed to have something to do with the named exported function from gatsby named graphql or with the useStaticQuery or with the withPreview from this module and the passed graphql query.

Edit 5:
It works fine on my WSL Ubuntu installation with both the Node.js 14.4.0 and the 12 LTS one. Seems like it doesn't work on my Windows machine.

DISCLAIMER

  • Previews DO NOT WORK on Windows 10 for me but do work on UNIX systems (Linux, Ubuntu, MacOS, etc.).
  • Search for TODO: in the project to find what config need to change accordingly to your project on prismic
  • Note that you have to use yarn to install dependencies. It might also break as you update dependencies or add them. If you can not deal with these issues, please put in some effort to find the breaking dependency and share it with us.
  • If you have time to look into what dependency changed and breaks the previews/static queries, please post a reply stating you will and keep us updated wether you making progress or plans on finishing the hunt any time soon change.
  • in multiple locations of the code i define /preview as the preview url suffix. Take notice of this if you differentiated from the standard.

Quick fix hack 🙈

Copy my yarn.lock file from the example project over yours and do a yarn install. It should start to work magically in most cases.

@LordLalwani
Copy link

Any updates on an official fix for it?

@kahilnayton
Copy link

The workaround that's working for me for production environment is it to copy the content of the gatsby-node.js from gatsby-source-graphql-universal from a project which was working before this problem cropped up. Then you paste this content into the gatsby-node.js of the project that errors out. I imagine the issue lies in how gatsby-source-prismic-graphql is installing its peer dependencies.

@Danm72
Copy link

Danm72 commented Jul 2, 2020

const _require = require('gatsby-source-graphql/gatsby-node'), sourceNodes = _require.sourceNodes;

I've found that swapping the first require within 'gatsby-source-graphql-universal/gatsby-node.js' works for me

@MarcMcIntosh
Copy link

HI,
Prsimic has released forks for this plugin https://www.npmjs.com/package/@prismicio/gatsby-source-prismic-graphql
and https://www.npmjs.com/package/@prismicio/gatsby-source-graphql-universal

@Danm72
Copy link

Danm72 commented Jul 3, 2020

@MarcMcIntosh I can't seem to get a build to run with that plugin ^

When i add this package:
"@prismicio/gatsby-source-prismic-graphql": "^3.6.6",`

and the plugin to my gatsby-config:
resolve: '@prismicio/gatsby-source-prismic-graphql',

I get:
` ERROR #11321 PLUGIN

"@prismicio/gatsby-source-prismic-graphql" threw an error while running the sourceNodes lifecycle:

executor is not a function

83 |
84 | if (!sdl) {

85 | introspectionSchema = yield introspectSchema(link);
| ^
86 | sdl = printSchema(introspectionSchema);
87 | } else {
88 | introspectionSchema = buildSchema(sdl);

File: node_modules/@prismicio/gatsby-source-graphql-universal/third-party/gatsby-node.js:85:37
`

@MarcMcIntosh
Copy link

Alright I look into that

@kahilnayton
Copy link

That new fork did the trick! Thanks

@steoneill
Copy link

@MarcMcIntosh the new fork seems to be giving back the issue with images as it was on issue #196

@ohlr
Copy link

ohlr commented Jul 7, 2020

When upgrading from 3.6.3-alpha.12 -> 3.6.3-alpha.13 this issue comes up.

@laradevitt
Copy link

Regarding @steoneill's comment, just wanted to note that the issue was posted in the prismic repo, along with a revised workaround (thanks to @TimFletcher):

prismicio#3

@MarcMcIntosh
Copy link

@steoneill Should be fixed on the fork :)

@lucashfreitas
Copy link

lucashfreitas commented Jul 10, 2020

@MarcMcIntosh, thanks for all work you have been doing.

Maybe someone can open and pin an issue telling that prismic team has created a fork of this plugin that has solved some issues already? I spent many time and had to dig to find out about it.

I also think Maybe prismic could update their website where they mention that the preview feature works with gatsby. The feature has some limitations and issues as reported here in the repo. So I would not consider that is 100% ready for production, specially for the preview feature. This is leading many users to believe that unlimited preview feature is actually working with gatsby.

Thinking like a developer I know that birkir and all the contributors have done a great job in developing this plugin for the community, but thinking like a user, I am a bit frustrated because I read on prismic website and watched an youtube video where prismic says that preview feature is working with gatsby, and that's why I made the decision to develop new projects using prismic. (I was using contentful + gatsby cloud before, where preview feature works really well).

I believe other users like me that develop websites using gatsby choose prismic because of it. Since prismic team adverts this plugin on your website saying that it works with gatsby, maybe prismic team could warn users about that limitation and current bugs?

Really appreciate all the work you have been doing, but I just developed a brand new website for a client and now really disappointing to tell my client that the preview feature doesn't work. If I knew that before maybe I could make a better decision instead of spending many hours ($$) troubleshooting issues with this plugin/preview feature.

We have issues like #45 that are a year old and still unresolved.

What if we start by addressing all current issues and creating a community chat on discord or something else where we can organize and plan how to solve all these issues? Please let me know if you need any help with this, I could help to organize/address all issues and also to put my hands into code to fix that.

Thanks again for all work you have been doing.

Cheers

@ohlr
Copy link

ohlr commented Jul 10, 2020

@lucashfreitas I think the best you/we can do is to create reproducible issues on the prismic fork

@natedonato
Copy link

For NPM newbies like me that need more specific instructions (I just posted this in a different issue but the fork also fixes this problem):

The easiest way I found to seamlessly switch to the prismic fork mentioned by @MarcMcIntosh was to first remove the old package (and any version of gatsby-source-graphql-universal), and then install the prismic version as an alias.

npm i gatsby-source-prismic-graphql@npm:@prismicio/gatsby-source-prismic-graphql

Can also be done by adding this to your package.json dependencies

"gatsby-source-prismic-graphql": "npm:@prismicio/gatsby-source-prismic-graphql@^3.6.10",

This should as far as I know work for any project without having to copy an old version of node modules or do other unfortunate dependency resolutions. I think it should work for production but haven't verified that yet.

@chrismejia
Copy link

Hello! It's the start of August and I wanted to highlight this reply from earlier in the thread for those just getting the issue now -- I can confirm this fix still works.

Fix: #217 (comment)

I have not yet tried what @natedonato has mentioned above as I found this fix reading chronologically and needed any fix to continue dev work. I will test it out later on considering it's a fork directly from Prismic.

Thank you @iamsainikhil!

@JoeHO888
Copy link

That fork works, I follow this comment. My spec is as below for your reference.

  • Node JS: v12.16.1
  • NPM: v6.14.7
  • OS: Windows 10

Gatsby-config.js:
{ resolve: 'gatsby-source-prismic-graphql', options: { repositoryName: '<Your Prismic Repo Name>', // required } },

@MsMaddyMac
Copy link

Has it been confirmed whether or not the fix from comment 217 works in production?

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

No branches or pull requests