gatsby-source-prismic-graphql icon indicating copy to clipboard operation
gatsby-source-prismic-graphql copied to clipboard

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

Open joeweale opened this issue 4 years ago • 76 comments

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

joeweale avatar May 28 '20 08:05 joeweale

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

aodysseos avatar May 28 '20 08:05 aodysseos

I have the same issue

AndrejGajdos avatar May 28 '20 09:05 AndrejGajdos

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!

aodysseos avatar May 28 '20 09:05 aodysseos

@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

AndrejGajdos avatar May 28 '20 09:05 AndrejGajdos

@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

aodysseos avatar May 28 '20 10:05 aodysseos

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

AndrejGajdos avatar May 28 '20 10:05 AndrejGajdos

Same problem here...

NSpehler avatar May 28 '20 10:05 NSpehler

Yep this seem to have started happening this morning

jodiedoubleday avatar May 28 '20 11:05 jodiedoubleday

Seems related to this commit: https://github.com/birkir/gatsby-source-graphql-universal/commit/f3491620523b800dccdf790872eedcfd6dc79555

NSpehler avatar May 28 '20 11:05 NSpehler

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

aodysseos avatar May 28 '20 11:05 aodysseos

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

NSpehler avatar May 28 '20 11:05 NSpehler

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

riccoski avatar May 28 '20 11:05 riccoski

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" },

zpthree avatar May 28 '20 23:05 zpthree

Same issue!

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

codebravotech avatar May 29 '20 00:05 codebravotech

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

botre avatar May 29 '20 06:05 botre

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 

mrseanbaines avatar May 29 '20 10:05 mrseanbaines

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.

miraclemaker avatar May 29 '20 14:05 miraclemaker

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

benwalio avatar May 29 '20 18:05 benwalio

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

AndrejGajdos avatar May 30 '20 08:05 AndrejGajdos

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.

subhashb avatar Jun 01 '20 22:06 subhashb

Same problem here 😥

RectoVersoDev avatar Jun 02 '20 12:06 RectoVersoDev

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

joshua-isaac avatar Jun 02 '20 14:06 joshua-isaac

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

olonade43 avatar Jun 02 '20 15:06 olonade43

@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

TatsumiSuenaga avatar Jun 02 '20 20:06 TatsumiSuenaga

Same issue...

mbbillz avatar Jun 03 '20 10:06 mbbillz

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

iamsainikhil avatar Jun 05 '20 05:06 iamsainikhil

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

noblica avatar Jun 09 '20 12:06 noblica

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

tynsoltys avatar Jun 09 '20 20:06 tynsoltys

would i be fine just using gatsby-source-prismic instead of this plugin? Am i losing any major benefits going that route?

joshua-isaac avatar Jun 09 '20 20:06 joshua-isaac