简体   繁体   English

Gatsby 开发失败:错误:找不到模块“gatsby-cli/lib/reporter”

[英]Gatsby Develop failing : Error: Cannot find module 'gatsby-cli/lib/reporter'

Keep getting an error from gatsby-cli when doing gatsby develop command in terminal.在终端中执行 gatsby develop 命令时,不断从 gatsby-cli 收到错误。

Already deleted node-modules and reinstalled using npm.已删除节点模块并使用 npm 重新安装。 Tried installing Gatsby-Cli as a separate module but that just causes more gatsby-cli errors.尝试将 Gatsby-Cli 作为单独的模块安装,但这只会导致更多 gatsby-cli 错误。 Gatsby-cli is a module inside the gatsby module, but I .really don't know why it's causing this error all of a sudden. Gatsby-cli 是 gatsby 模块中的一个模块,但我真的不知道为什么它会突然导致这个错误。

$ gatsby develop

success open and validate gatsby-configs - 0.054 s
error Error in


  Error: Cannot find module 'gatsby-cli/lib/reporter'

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

  - loader.js:508 Function.Module._load
    internal/modules/cjs/loader.js:508:25

  - loader.js:637 Module.require
    internal/modules/cjs/loader.js:637:17

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

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

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

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

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

  - loader.js:539 tryModuleLoad
    internal/modules/cjs/loader.js:539:12

  - loader.js:531 Function.Module._load
    internal/modules/cjs/loader.js:531:3

  - loader.js:637 Module.require
    internal/modules/cjs/loader.js:637:17

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

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

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

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

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



after I updated some packages I started getting this gastby-cli error.在我更新了一些软件包后,我开始收到这个 gastby-cli 错误。 I've never seen it before and its really annoying.我以前从未见过它,它真的很烦人。 Don't know of a solution.不知道有什么解决办法。

Looks like something internal to Gatsby broke today, the Dev team is working on it看起来 Gatsby 内部的某些东西今天坏了,开发团队正在处理它

https://github.com/gatsbyjs/gatsby/issues/14875 https://github.com/gatsbyjs/gatsby/issues/14875

After I tried everything.在我尝试了一切之后。 I uninstalled everything and run npm install --save -g gatsby-cli does work for me我卸载了所有东西并运行npm install --save -g gatsby-cli对我npm install --save -g gatsby-cli

Thank you guys. 感谢大伙们。 you guys are really helpful. 你们真的很有帮助。 Answer this for those who are still facing problem. 为仍然面临问题的人回答这个问题。

try this for linux 在Linux上尝试一下

sudo gatsby new gatsby-site
cd gatsby-site
sudo gatsby develop

And For windows run your command prompt as administrator and enter those command it should work 对于Windows,以管理员身份运行命令提示符,然后输入这些命令即可运行

gatsby new gatsby-site
cd gatsby-site
gatsby develop

尝试更新gatsby版本

npm i gatsby

I saw the same error these days when trying to launch a Starter Template.这些天我在尝试启动入门模板时看到了同样的错误。 What worked for me is first to up the version of gatsby on package.json ( "gatsby": "^2.24.42", ).对我有用的是首先在 package.json ( "gatsby": "^2.24.42", ) 上升级 gatsby 的版本。 Then just remove the package-lock and do the npm-install .然后只需删除 package-lock 并执行npm-install On my side that fixed the error.在我这边修复了错误。

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

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