birkir / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
137 stars 75 forks source link

Build fails with clean install - murmurhash is not a function #203

Closed radovalach closed 4 years ago

radovalach commented 4 years ago

Hi! I'm trying to create new project using gatsby-source-prismic-graphql but I can't even build the project with basic configuration. It was working fine on my older project though.

Steps to reproduce:

Result:

success open and validate gatsby-configs - 0.046s
success load plugins - 0.611s
success onPreInit - 0.012s
success initialize cache - 0.011s
success copy gatsby files - 0.053s
success onPreBootstrap - 0.008s
success createSchemaCustomization - 0.004s
success source and transform nodes - 7.266s
success building schema - 0.247s
success createPages - 0.012s
success createPagesStatefully - 0.104s
success onPreExtractQueries - 0.001s
success update schema - 0.028s
success extract queries from components - 0.457s
success write out requires - 0.034s
success write out redirect data - 0.003s
success Build manifest and related icons - 0.128s
success onPostBootstrap - 0.136s
⠀
info bootstrap finished - 12.803 s
⠀
success run queries - 0.140s - 9/9 64.39/s
success Generating image thumbnails - 2.786s - 6/6 2.15/s

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

/Users/rvalach/work/projects/test/.cache/dev-404-page.js: murmurhash is not a function

File: .cache/dev-404-page.js

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

/Users/rvalach/work/projects/test/src/components/image.js: murmurhash is not a function

File: src/components/image.js

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

/Users/rvalach/work/projects/test/src/components/layout.js: murmurhash is not a function

File: src/components/layout.js

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

/Users/rvalach/work/projects/test/src/components/seo.js: murmurhash is not a function

File: src/components/seo.js

failed Building development bundle - 5.447s

Versions:

Gatsby CLI version: 2.12.10
Gatsby version: 2.21.13

package.json

{
  "name": "gatsby-starter-default",
  "private": true,
  "description": "A simple starter to get up and developing quickly with Gatsby",
  "version": "0.1.0",
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
  "dependencies": {
    "gatsby": "^2.21.13",
    "gatsby-image": "^2.4.1",
    "gatsby-plugin-manifest": "^2.4.2",
    "gatsby-plugin-offline": "^3.2.1",
    "gatsby-plugin-react-helmet": "^3.3.1",
    "gatsby-plugin-sharp": "^2.6.1",
    "gatsby-source-filesystem": "^2.3.1",
    "gatsby-source-prismic-graphql": "^3.6.2",
    "gatsby-transformer-sharp": "^2.5.1",
    "prop-types": "^15.7.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-helmet": "^6.0.0"
  },
  "devDependencies": {
    "prettier": "2.0.5"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "format": "prettier --write \"**/*.{js,jsx,json,md}\"",
    "start": "npm run develop",
    "serve": "gatsby serve",
    "clean": "gatsby clean",
    "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gatsbyjs/gatsby-starter-default"
  },
  "bugs": {
    "url": "https://github.com/gatsbyjs/gatsby/issues"
  }
}

Do you know what causes problem with murmurhash and how to fix it? Thanks!

BartvdWaerden commented 4 years ago

I'm experiencing the same problem, even reverting to an older version (3.3.1) of this plugin didn't solve this error.

Jrousell commented 4 years ago

Same here, started yesterday .... tried various versions of node, done the usual removal of node_modules, yarn/npm locks and just about everything else.

avcohen commented 4 years ago

Same. Trying to troubleshoot issues using imageSharp and changed versions, albeit to a lower one, and this began.

jodiedoubleday commented 4 years ago

Yep same, started for me yesterday at 2pm(gmt), I've tried re-installing absolutely everything. Though the only update to this plugin was 8 days ago, so this could be an issue with Prismic?

MarcMcIntosh commented 4 years ago

Hi @radovalach Thanks for letting us know about this issue.

If it's urgent then I would recommend using this version of the gatsby-source-prismic-graphql plugin until the gatsby-source-graphql-universal plugin is fixed and updated.

npm install --save prismicio/gatsby-source-prismic-graphql#flat then run npm run clean && npm start

That should be the problem solved :)

jodiedoubleday commented 4 years ago

@MarcMcIntosh using #flat works for now, thank you!

noblica commented 4 years ago

Hi @MarcMcIntosh , I tried your solution, but I get the following error, when executing npm install --save prismicio/gatsby-source-prismic-graphql#flat:

npm install --save prismicio/gatsby-source-prismic-graphql#flat
npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > core-js@2.6.11 postinstall /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331/node_modules/core-js
npm ERR! prepareGitDep > node -e "try{require('./postinstall')}catch(e){}"
npm ERR! prepareGitDep 
npm ERR! prepareGitDep Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
npm ERR! prepareGitDep 
npm ERR! prepareGitDep The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
npm ERR! prepareGitDep > https://opencollective.com/core-js 
npm ERR! prepareGitDep > https://www.patreon.com/zloirock 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > core-js-pure@3.6.5 postinstall /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331/node_modules/core-js-pure
npm ERR! prepareGitDep > node -e "try{require('./postinstall')}catch(e){}"
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby-telemetry@1.2.3 postinstall /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331/node_modules/gatsby-telemetry
npm ERR! prepareGitDep > node src/postinstall.js || true
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby-cli@2.11.8 postinstall /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331/node_modules/gatsby/node_modules/gatsby-cli
npm ERR! prepareGitDep > node scripts/postinstall.js
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby@2.20.22 postinstall /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331/node_modules/gatsby
npm ERR! prepareGitDep > node scripts/postinstall.js
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby-source-prismic-graphql@3.5.0 prepare /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331
npm ERR! prepareGitDep > npm run clean && cross-env NODE_ENV=production npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby-source-prismic-graphql@3.5.0 clean /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331
npm ERR! prepareGitDep > rimraf {interfaces,types,components,utils,*.js}
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > gatsby-source-prismic-graphql@3.5.0 build /home/dusan/.npm/_cacache/tmp/git-clone-a3b31331
npm ERR! prepareGitDep > tsc --emitDeclarationOnly && babel src --out-dir ./ --extensions '.js,.ts,.tsx'
npm ERR! prepareGitDep 
npm ERR! prepareGitDep src/components/WrapPage.tsx(1,23): error TS2307: Cannot find module 'lodash/clonedeep'.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 2
npm ERR! prepareGitDep npm ERR! gatsby-source-prismic-graphql@3.5.0 build: `tsc --emitDeclarationOnly && babel src --out-dir ./ --extensions '.js,.ts,.tsx'`
npm ERR! prepareGitDep npm ERR! Exit status 2
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the gatsby-source-prismic-graphql@3.5.0 build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/dusan/.npm/_logs/2020-05-06T21_29_52_009Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 2
npm ERR! prepareGitDep npm ERR! gatsby-source-prismic-graphql@3.5.0 prepare: `npm run clean && cross-env NODE_ENV=production npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 2
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the gatsby-source-prismic-graphql@3.5.0 prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/dusan/.npm/_logs/2020-05-06T21_29_52_057Z-debug.log
npm ERR! prepareGitDep 
npm ERR! premature close

Do you know what might be the issue?

I tried with node versions v12.16.1 and v10.19.0 My npm version is: 6.14.5

MarcMcIntosh commented 4 years ago

@noblica Have you trried deleting your node_module directory?

thebatz commented 4 years ago

Hi @MarcMcIntosh same for me, I had the issue then followed your recomandations. After updating npm install --save prismicio/gatsby-source-prismic-graphql#flat I can build locally, but when trying deploy to Netlify build failed with the same error as @noblica.

noblica commented 4 years ago

@MarcMcIntosh yep, it still fails. Looking at the log, it seems to fail in the build step, because of some missing dependencies:

npm ERR! prepareGitDep src/components/WrapPage.tsx(1,23): error TS2307: Cannot find module 'lodash/clonedeep'.

I also cloned the repo locally, it throws the same issue when running npm install. It seems that the issue was a typo with the lodash import (clonedeep vs cloneDeep). I created a PR here, can you please take a look?

veloce commented 4 years ago

Hi there, a fix is on its way: https://github.com/birkir/gatsby-source-graphql-universal/pull/16

MarcMcIntosh commented 4 years ago

@noblica the fix has been merged :) thanks :)

codebravotech commented 4 years ago

@MarcMcIntosh @veloce @birkir

I'm still getting this issue after trying both:

So I don't think this issue should be closed yet?

Using the version off of the prismicio fork's "flat" branch, I'm running into the same lodash/clonedeep issue called out by @noblica (building within AWS Codepipeline).

I'm confused about two things: 1) the PR @nobilica added seems to have been merged, so I'm not sure why I'm still seeing the bug in question? 2) What is the long term approach to this issue since it doesn't appear to be fixed on birkir's root repo?

codebravotech commented 4 years ago

Additionally, when I bump to either of the versions listed in my comment above (from 3.4-beta.2, which I've been using for a while), I get "module not found" errors when I run gatsby develop:

Any help would be really appreciated.

noblica commented 4 years ago
  • When I use "birkir/gatsby-source-prismic-graphql" (3.4-beta.2 OR 3.6.2) the missing module is "babel-plugin-remove-graphql-queries"

Maybe it's a typo, but I see the latest version for this package, in it's package.json, is 3.3.0. And for the #flat one it's 3.5.0. I don't see 3.6.2 anywhere. Could that be the issue?

codebravotech commented 4 years ago

@noblica Thanks for the input!

Since you're referencing the #flat branch, I think what you're looking at is probably the prismicio fork of the original gatsby-source-prismic-graphql by birkir.

Which is part of my question- whether the community is supposed to be using that fork going forward and if so, why hasn't npm been updated to point at it? (Currently if you just npm install or yarn add gatsby-source-prismic-graphql without specifying a repo, branch, and/or version number you get 3.6.2 from birkir)

noblica commented 4 years ago

@codebravotech Hey, my bad, you are correct, I have the 3.6.2 version installed, as you mentioned. But it seems to be working for me. I'm guessing you already tried deleting both the node_modules and package.lock files, and re-installing?

codebravotech commented 4 years ago

I deleted my previous comments to not send others down the wrong road- the issue for me was in another use of murmurhash elsewhere in my dependencies that needs to be fixed in the same way veloce did in birkir/gatsby-source-graphql-universal#16