简体   繁体   English

如何修复 Gatsby 开发错误:找不到模块“gatsby-cli/lib/reporter”?

[英]How To Fix Gatsby Develop Error: Cannot find module 'gatsby-cli/lib/reporter'?

Getting problem with Gatsby.盖茨比有问题。 It's is showing Error: Cannot find module 'gatsby-cli/lib/reporter' in command prompt when I am running gatsby develop .当我运行gatsby develop时,它显示Error: Cannot find module 'gatsby-cli/lib/reporter'在命令提示符中Error: Cannot find module 'gatsby-cli/lib/reporter' How can I solve it please answer.怎么解决,求解答。

Error Message错误信息

E:\JavaScript\gatsby-js> gatsby develop
success open and validate gatsby-configs - 0.008 s
error Error in "E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js":


  Error: Cannot find module 'gatsby-cli/lib/reporter'
  Require stack:
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\utils.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\create-file-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\commands\develop.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js

  - loader.js:623 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:623:15

  - loader.js:527 Function.Module._load
    internal/modules/cjs/loader.js:527:27

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - utils.js:15 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/utils.js:15:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - create-file-node.js:7 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/create-file-node.js:7:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - gatsby-node.js:12 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/gatsby-node.js:12:19

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32


⠋ load plugins

I experienced the same issue as you.我遇到了和你一样的问题。 Install the missing module to your project with:使用以下命令将缺少的模块安装到您的项目中:

npm install --save gatsby-cli

Solution is from https://github.com/gatsbyjs/gatsby/issues/4131解决方案来自https://github.com/gatsbyjs/gatsby/issues/4131

As an immediate workaround you can use yarn instead of npm作为一种直接的解决方法,您可以使用yarn而不是npm

rm -rf node_modules
yarn
gatsby develop

Solution here: https://github.com/gatsbyjs/gatsby/issues/14875解决方案在这里: https : //github.com/gatsbyjs/gatsby/issues/14875

Remove node-modules and package-lock.json , and reinstall them by running npm install .删除node-modulespackage-lock.json ,然后通过运行npm install重新安装它们。 Fixed mine!✔️固定我的!✔️

我的一个是通过只删除node_modules然后使用“ npm install ”重新安装来修复的

Getting problem with Gatsby.遇到盖茨比问题。 It's is showing Error: Cannot find module 'gatsby-cli/lib/reporter' in command prompt when I am running gatsby develop .它显示Error: Cannot find module 'gatsby-cli/lib/reporter'当我运行gatsby develop时, gatsby develop在命令提示符下Error: Cannot find module 'gatsby-cli/lib/reporter' How can I solve it please answer.我该如何解决,请回答。

Error Message错误信息

E:\JavaScript\gatsby-js> gatsby develop
success open and validate gatsby-configs - 0.008 s
error Error in "E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js":


  Error: Cannot find module 'gatsby-cli/lib/reporter'
  Require stack:
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\utils.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\create-file-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\commands\develop.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js

  - loader.js:623 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:623:15

  - loader.js:527 Function.Module._load
    internal/modules/cjs/loader.js:527:27

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - utils.js:15 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/utils.js:15:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - create-file-node.js:7 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/create-file-node.js:7:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - gatsby-node.js:12 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/gatsby-node.js:12:19

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32


⠋ load plugins

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM