When trying to do gatsby build
, I'm noticing that my custom source plugins as well as Gatsby packages are trying to find gatsby-cli/lib/reporter
, so every build fails with something that looks like this:
error Error in "/Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/gatsby-node.js":
Error: Cannot find module 'gatsby-cli/lib/reporter'
Require stack:
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/utils.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/scheduler.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/gatsby-node.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/commands/build.js
- /Users/jaredsilver/.nvm/versions/node/v12.2.0/lib/node_modules/gatsby-cli/lib/create-cli.js
- /Users/jaredsilver/.nvm/versions/node/v12.2.0/lib/node_modules/gatsby-cli/lib/index.js
I've tried a few different versions of gatsby, gatsby-cli, and where gatsby-cli lives, but this is one example:
System:
OS: macOS High Sierra 10.13.3
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 74.0.3729.169
Firefox: 59.0.2
Safari: 11.0.3
npmPackages:
gatsby: ^2.9.4 => 2.9.6
gatsby-image: ^2.1.4 => 2.1.4
gatsby-plugin-emotion: ^4.0.6 => 4.0.7
gatsby-plugin-portal: ^1.0.7 => 1.0.7
gatsby-plugin-purgecss: ^4.0.0 => 4.0.0
gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
gatsby-plugin-react-svg: ^2.1.1 => 2.1.1
gatsby-plugin-sass: ^2.0.11 => 2.0.11
gatsby-plugin-sentry: ^1.0.1 => 1.0.1
gatsby-plugin-sharp: ^2.1.5 => 2.1.6
gatsby-source-apiserver: ^2.1.2 => 2.1.2
gatsby-source-filesystem: ^2.0.39 => 2.0.40
gatsby-source-graphql: ^2.0.19 => 2.0.19
gatsby-transformer-sharp: ^2.1.21 => 2.1.21
gatsby-transformer-yaml: ^2.1.12 => 2.1.12
npmGlobalPackages:
gatsby-cli: 2.6.9
This is very weird. If we look at [email protected], we can see that that file exists like we'd expect: https://unpkg.com/[email protected]/lib/reporter/index.js
Not an ideal solution, but I'd guess that using the _local_ version of the Gatsby CLI, e.g. something like (in package.json):
{
"scripts": {
"build": "gatsby build"
}
}
and then npm run build
would iron out the issue--but we'll still want to get this fixed.
My initial thinking is that #14220 may contain a breaking change we'll need to iron out.
Having exactly the same issue! Rolling back to previous version fixes it.
Can confirm that it can be reproduced with node 8.10.0. Works fine with >8.11.0
Indeed, pinning at 2.6.8 locally seems to sort of work for now if I use npm run build
. Interestingly I get some new errors I've never seen before -- perhaps unrelated though:
success open and validate gatsby-configs - 0.011 s
success load plugins - 2.161 s
success onPreInit - 0.008 s
success delete html and css files from previous builds - 0.076 s
success initialize cache - 0.020 s
success copy gatsby files - 0.054 s
success onPreBootstrap - 0.008 s
â ¹ source and transform nodes
error (node:35205) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
success source and transform nodes - 5.634 s
success building schema - 0.649 s
success Downloading remote files — 330/330 - 6.284 s
success createPages - 0.422 s
success createPagesStatefully - 0.112 s
success onPreExtractQueries - 0.006 s
success update schema - 0.041 s
success extract queries from components - 0.247 s
success write out requires - 0.007 s
success write out redirect data - 0.002 s
success onPostBootstrap - 0.002 s
â €
info bootstrap finished - 11.305 s
â €
success run static queries - 0.050 s — 10/10 219.06 queries/second
success Building production JavaScript and CSS bundles - 60.368 s
success Rewriting compilation hashes - 0.003 s
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in
the componentWillUnmount method.
success run page queries - 19.443 s — 411/411 21.15 queries/second
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gatsby build`
npm ERR! Exit status 1
(I can't tell if these are related to my app or related to something within Gatsby. I'm inclined to believe it's related to Gatsby given that these were not issues in previous versions.)
Encountered this issue, too. Using Node 10.15.0
When I install gatsby-cli locally (npm install --save gatsby-cli), and run gatsby develop, I encounter this error:
`Error Warning: Can't perform a React state update on an unmounted
component. This is a no-op, but it indicates a memory leak in your
error UNHANDLED REJECTION
TypeError: Cannot read property 'type' of undefined
reporter.js:78 Object.done
[mcmc2]/[gatsby]/[gatsby-cli]/lib/reporter/reporters/ink/reporter.js
:78:54
index.js:132 Object.end
[mcmc2]/[gatsby]/[gatsby-cli]/lib/reporter/index.js:132:18
index.js:134
[mcmc2]/[gatsby]/dist/bootstrap/index.js:134:14
Generator.next`
Oh my, I'll have a look.
Same error here with node v9.11.2
If I use gastby cli 2.6.9 I have:
Error: Cannot find module 'gatsby-cli/lib/reporter'
If I downgrade to gastby cli 2.6.7 I have:
Error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method in GatsbyReporter
I'm seeing the same issue.
Attempting to bump the following dependencies in my project:
gatsby-source-filesystem
from 2.0.39 to 2.0.40gatsby-plugin-sharp
from 2.0.35 to 2.1.6Both are failing my CI tests with:
Error: Cannot find module 'gatsby-cli/lib/reporter'
Build logs here:
gatsby-source-filesystem
: https://travis-ci.org/MitchellCash/MitchellCash.com/jobs/547297821gatsby-plugin-sharp
: https://travis-ci.org/MitchellCash/MitchellCash.com/jobs/547290392The change log for gatsby-source-filesystem
only includes changes from PR #14220 so would agree with @DSchau on potentially blaming that.
I tried different versions of node by setting "engines": { "node": "8.10.0" }
and dependencies: { "node": "8.10.0" }
and it just produces the same errors. I have tried with 8.10.0
, 8.11.0
and 8.11.2
.
Seeing this issue too. As others have mentioned I'm able to get round this for the moment by installing the latest gatsby-cli package locally (2.6.9)
npm install --save-dev gatsby-cli
Been pulling my hair out suddenly cant develop on my gatsby project. I've tried installing many different versions of node / npm all with the same error
Strange. The main project I'm working on is unaffected... but, if I try a fresh default project or "wordpress-tutorial-site", I can't even "gatsby develop" those. I had just ran "npm i gatsby-cli" not too long ago.
Strange. The main project I'm working on is unaffected... but, if I try a fresh default project or "wordpress-tutorial-site",
Because it probably uses the lockfile which uses an older release.
If y'all delete your lock files and reinstall, does that help?
If y'all delete your lock files and reinstall, does that help?
Negative
@KyleAMathews same issue still.
Ran:
rm -fr package-lock.json node_modules/
npm install
npm run develop
Error: Cannot find module 'gatsby-cli/lib/reporter'
Hi, I'm using Gatsby for the first time today. I followed the Quick Start docs and got up to the point where I run gatsby develop
... and get the same error above: Error: Cannot find module 'gatsby-cli/lib/reporter'
Using Gatsby v2.6.9 and tried with both Node v10.15.3 and v8.5.0.
https://github.com/gatsbyjs/gatsby/issues/14875#issuecomment-503203439
Oh my, I'll have a look.
@MitchellCash I've been using your reproduction to test this.
(I'm using Node 11 and NPM 6.7.0; may matter)
git clone [email protected]:MitchellCash/MitchellCash.com.git
cd MitchellCash.com
git fetch origin dependabot/npm_and_yarn/gatsby-source-filesystem-2.0.40 && git checkout dependabot/npm_and_yarn/gatsby-source-filesystem-2.0.40
npm install
npm run build
What I'm seeing currently:
ls node_modules | grep gatsby-cli
returns nothing)I'd imagine other people can confirm this as well. While I investigate further, this should be able to be fixed _now_ with a temporary band-aid:
npm install gatsby-cli --save-dev
This will ensure the dependency makes its way into your node_modules tree. This shouldn't be necessary, so please treat this as temporary.
@DanielRuf reproduced locally with node v10.15.3 / npm v6.9.0
and also on my continuous deployment pipeline which uses node v8.16.0 / npm v6.4.1
. @DSchau also reproduced with node v11 / npm v6.7.0
.
@DSchau thanks for reproducing and providing a temporary fix!
If i npm install gatsby-cli locally i get into another issue :
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in
your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
Seems like a similar issue - I recently updated Gatsby to latest version and my Netlify deploy is hanging at success Rewriting compilation hashes - 0.003 s
This is caused by https://github.com/gatsbyjs/gatsby/commit/967597c12fc5d227de4c1767bf82bc751f2fe0d0
gatsby-plugin-sharp
: src/utils.js
gatsby-source-filesystem
: src/utils.js
Because of require(`gatsby-cli/lib/reporter`)
This error doesn't occur for yarn
because yarn
flattens the node_modules
tree. So, gatsby-cli
is available at ./node_modules/gatsby-cli
. With npm
it's ./node_modules/gatsby/node_modules/gatsby-cli
.
It works after npm install gatsby-cli --save-dev
because, it adds gatsby-cli
at top level: ./node_modules/gatsby-cli
@wardpeet @DanielRuf
@zappys - I'm getting same error after running npm install gatsby-cli --save-dev
The output is:
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but
it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous
error UNHANDLED REJECTION
TypeError: Cannot read property 'startTime' of undefined
@MunifTanjim he is aware of it, see https://github.com/gatsbyjs/gatsby/issues/14875#issuecomment-503203439
@zappys - I'm getting same error after running
npm install gatsby-cli --save-dev
The output is:
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous
error UNHANDLED REJECTION
TypeError: Cannot read property 'startTime' of undefined
I am also getting this after adding gatsby-cli
Hi, I try gatsby today firs time, and has the same issuse, I am created gatsby-site run npm start
and fet error:
Error: Cannot find module 'gatsby-cli/lib/reporter'
- loader.js:636 Function.Module._resolveFilename
internal/modules/cjs/loader.js:636:15
- loader.js:562 Function.Module._load
internal/modules/cjs/loader.js:562:25
- loader.js:690 Module.require
internal/modules/cjs/loader.js:690:17
- v8-compile-cache.js:159 require
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:159:20
- utils.js:15 Object.<anonymous>
[gatsby-garb]/[gatsby-source-filesystem]/utils.js:15:18
- v8-compile-cache.js:178 Module._compile
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:178:30
- loader.js:787 Object.Module._extensions..js
internal/modules/cjs/loader.js:787:10
- loader.js:653 Module.load
internal/modules/cjs/loader.js:653:32
- loader.js:593 tryModuleLoad
internal/modules/cjs/loader.js:593:12
- loader.js:585 Function.Module._load
internal/modules/cjs/loader.js:585:3
- loader.js:690 Module.require
internal/modules/cjs/loader.js:690:17
- v8-compile-cache.js:159 require
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:159:20
- create-file-node.js:7 Object.<anonymous>
[gatsby-garb]/[gatsby-source-filesystem]/create-file-node.js:7:18
- v8-compile-cache.js:178 Module._compile
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:178:30
- loader.js:787 Object.Module._extensions..js
internal/modules/cjs/loader.js:787:10
- loader.js:653 Module.load
internal/modules/cjs/loader.js:653:32
- loader.js:593 tryModuleLoad
internal/modules/cjs/loader.js:593:12
- loader.js:585 Function.Module._load
internal/modules/cjs/loader.js:585:3
- loader.js:690 Module.require
internal/modules/cjs/loader.js:690:17
- v8-compile-cache.js:159 require
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:159:20
- gatsby-node.js:12 Object.<anonymous>
[gatsby-garb]/[gatsby-source-filesystem]/gatsby-node.js:12:19
- v8-compile-cache.js:178 Module._compile
[gatsby-garb]/[v8-compile-cache]/v8-compile-cache.js:178:30
â ‹ load plugins
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] develop: `gatsby develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Home\AppData\Roaming\npm-cache\_logs\2019-06-18T19_15_54_990Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
When I asked google about my problem and he give me an solution [#4122](https://github.com/gatsbyjs/gatsby/pull/4122)
, I tryed this, but get another error, I forgot but something with sdk 8.1, I'm installed sdk, install gatsby-plugin-sharp
1.6.31 the problem is not gone
As an immediate workaround you can use yarn
instead of npm
rm -rf node_modules
yarn
gatsby develop
@604karev see https://github.com/gatsbyjs/gatsby/pull/14881
@polkhovsky , thanks, this works for me
I get a different error when running yarn
after removing node_modules
Fetch Contentful data: 4556.579ms
success source and transform nodes - 6.949 s
â ¹ building schema
Error: Schema must contain uniquely named types but contains multiple types named "JSON".
- Array.reduce
- Array.reduce
@doodybrains that seems something else, could you create another issue for this.
I think I fixed the issue with NPM. I would love if people can test it out for me. I've updated a lot of packages so please install the correct packages. For example if you have gatsby-source-wordpress
installed, please install gatsby-source-wordpress@reporter-npm
I published some versions to test, please install the ones that are in your package.json
npm install gatsby-plugin-sharp@reporter-npm
npm install gatsby-source-contentful@@reporter-npm
npm install gatsby-source-drupal@reporter-npm
npm install gatsby-source-filesystem@reporter-npm
npm install gatsby-source-shopify@reporter-npm
npm install gatsby-source-wordpress@reporter-npm
npm install gatsby-transformer-screenshot@reporter-npm
npm install gatsby-transformer-sqip@reporter-npm
+1 for @polkhovsky 's workaround
@wardpeet I tried with NPM, I ran these commands:
rm -fr package-lock.json node_modules/
npm install
gatsby develop
And I got this error:
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but
it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous
error UNHANDLED REJECTION
TypeError: Cannot read property 'type' of undefined
- reporter.js:78 Object.done
[myblog]/[gatsby]/[gatsby-cli]/lib/reporter/reporters/ink/reporter.js:78:54
- index.js:132 Object.end
[myblog]/[gatsby]/[gatsby-cli]/lib/reporter/index.js:132:18
- index.js:134
[myblog]/[gatsby]/dist/bootstrap/index.js:134:14
- Generator.next
And anyway, requiring to use yarn
not a valid option.
I'm having all this on node 12.4.0 / npm 6.9.0, just trying to set up a demo for a doc purpose.
Thanks to @MunifTanjim above for tieing this down for causes!
Maybe we could get #14800 repaired also, to stop similar new trying user befuddlement??
Thanks
@wardpeet thank you. i npm installed for plugin-sharp
and source-contentful
but got
after running yarn develop
error Plugin gatsby-transformer-sharp returned an error
Error: Cannot find module 'sharp'
tried running
npm install gatsby-transformer-sharp@reporter-npm
but that returned an error.
@wardpeet sorry. i removed gatsby-transformer-sharp
and now everything works...
@jkaracozoff that seems a different bug, any reproduction you can create for me? Feel free to send me a private email [email protected]
@narration-sd it's getting a bit late for me, I'll try to get to it this week.
@wardpeet Thanks, friend -- fully understand about the 'getting late' part, just did that in the other timezone direction as often, last night...
UPDATE: NPM appears to be working now, don't forget to install ALL the packages you need (he said to himself...), thanks @wardpeet !
npm install gatsby-plugin-sharp@reporter-npm
npm install gatsby-source-contentful@@reporter-npm
npm install gatsby-source-drupal@reporter-npm
npm install gatsby-source-filesystem@reporter-npm
npm install gatsby-source-shopify@reporter-npm
npm install gatsby-source-wordpress@reporter-npm
npm install gatsby-transformer-screenshot@reporter-npm
npm install gatsby-transformer-sqip@reporter-npm
Following @wardpeet 's instructions and installing the necessary @reporter-npm packages works.
For me, it was the following:
npm install gatsby-plugin-sharp@reporter-npm
npm install gatsby-source-filesystem@reporter-npm
Thank you!
we rolled back the change for now so the latest npm packages shouldn't have this issue. We'll reiterate on the reporter-npm fix and ship it somewhere this week.
Thanks for sticking with us and helping us debug this issue! :heart: Sorry for the inconveniences it may have caused.
Successfully published:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
@wardpeet thanks for the quick responses!
I bumped my dependencies to the latest and we are all good again!
I also tested the two in development dependencies and they also solved this problem for me:
gatsby-plugin-sharp@reporter-npm
gatsby-source-filesystem@reporter-npm
Just to add for others: you do apparently need to add the two @reporter-related libraries, after getting npm to actually install and use the back-versioned gatsby-cli (by npm -g remove gatsby-cli, locally also if you have one there).
The library adds, as close above from @benryerson, done in the created new site:
With these, it works, and thanks again @wardpeet @MunifTanjim
@MitchellCash Mitchell, I'm trying to understand what exactly you meant about having success by 'bump[ing] dependencies'
I've got the fixed gatsby-cli of today to work in creating a buildable site, but only by fresh gatsby new sitename
followed by manual npm install of both @reporter-npm tagged plugins.
To discover your meaning, I tried several variations on removing node_modules and package-lock.json, then npm install. As far as I know, this kind of trash-restore is the only way to get npm to prefer currently 'updated' dependencies, other than some obscure scripting plugins. My unsuccessful variations meant doing npm cache clear --force
and -g version before the clean npm install
.
Or did you mean manually changing all the versions in the list above from @wardpeet in the package.json, then npm update
to call them into node_modules? Just thought of that, will have to try it.
[added] And no, that didn't work either. I continue to get the error WebpackError: ./.cache/develop-static-entry.js
, until I install the two @reporter-npm additions.
You guys will have to forgive a little. I've just come off a tug of war with npm over updates to .beta-n plugins, which in fact it won't do. You have to go manual or remove-add there. That's the kind of iron rule I'm looking to understand here.
@narration-sd what I meant was the following versions worked for me:
[email protected]
gatsby-plugin-sharp@reporter-npm
[email protected]
gatsby-source-filesystem@reporter-npm
The following (the cause of this whole issue thread) did not work for me:
If you are still having issues you might want to wait for the Gatsby dependencies in https://github.com/gatsbyjs/gatsby-starter-default/blob/master/package.json to be bumped to the latest versions as they are still pointing to the broken versions (as of the time I write this).
Once that is done you will be able to run gatsby new sitename
again without having to manually install different versions from the starter.
we just published a new version, i'll be bumping our starters in a few minutes.
@MitchellCash Thanks for the clarification, Mitchell. What you say is exactly what I arrived at.
Most helpful comment
we rolled back the change for now so the latest npm packages shouldn't have this issue. We'll reiterate on the reporter-npm fix and ship it somewhere this week.
Thanks for sticking with us and helping us debug this issue! :heart: Sorry for the inconveniences it may have caused.