algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
177 stars 45 forks source link

Error on build - Error: Cannot find module 'gatsby-cli/lib/reporter' #123

Closed richhiggins closed 3 years ago

richhiggins commented 3 years ago

This is a new project, with "gatsby": "^3.1.1", and "gatsby-plugin-algolia": "^0.17.0",

Any fix advice out there? Bit of a blocker for me 😬

thanks


Error: Cannot find module 'gatsby-cli/lib/reporter'
  Require stack:
  - /[projectpath]/node_modules/gatsby-plugin-algolia/gatsby-node.js
  - /[projectpath]/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
  - /[projectpath]/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
  - /[projectpath]/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
  - /[projectpath]/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
  - /[projectpath]/node_modules/gatsby/dist/services/initialize.js
  - /[projectpath]/node_modules/gatsby/dist/services/index.js
  - /[projectpath]/node_modules/gatsby/dist/bootstrap/index.js
  - /[projectpath]/node_modules/gatsby/dist/commands/build.js
  - /[projectpath]/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js
  - /[projectpath]/node_modules/gatsby/node_modules/gatsby-cli/lib/index.js
  - /[projectpath]/node_modules/gatsby/dist/bin/gatsby.js
  - /[projectpath]/node_modules/gatsby/cli.js
Haroenv commented 3 years ago

in v3, do you not have gatsby-cli installed anymore? I haven't tried v3 yet, but I can see that reporter still exists as part of v3. Can you try installing Gatsby-cli separately and see if that makes an impact?

richhiggins commented 3 years ago

@Haroenv yeah there is no gatsby-cli in node_modules for me. It doesn't appear to be in the Gatsby dependencies.

I've now manually installed it locally (I had it globally already) and this has fixed the issue. I'm not sure this is the ideal solution (also adds 2.3mb) but it certainly works.