繁体   English   中英

Gatsby - 错误:找不到模块 '..\node_modules\gatsby\dist\utils\babel-loader.js'

[英]Gatsby - Error: Cannot find module '..\node_modules\gatsby\dist\utils\babel-loader.js'

运行gatsby develop时,在gatsby new之后使用教程中提供的配置 - https://www.gatsbyjs.com/docs/tutorial/part-1/ ,我收到此错误

模块构建失败(来自../../my-first-gatsby-sitenode_modules/gatsby/dist/utils/babel-loader.js):错误:找不到模块'..\my-first-gatsby-site\node_modules \gatsby\dist\utils\babel-loader.js'

我尝试过的解决方案:

  1. 删除 node_modules, package-lock => npm install / yarn.
  2. node_modules/gatsby中运行npm install
  3. npm -g --save babel-loader。

如果您遇到错误并能够解决它,请提供帮助。 TIA。

node_modules/gatsby中运行npm install

npm install必须在项目的根目录中运行,而不是在node_modules中。

删除 node_modules, package-lock => npm install / yarn.

您应该只选择 npm 或纱线,不能同时选择两者。

尝试以下操作:

  • 运行以下命令: npm install --save gatsby-cli
  • 如果在上一条命令之前有许多审计警告,请运行: npm audit fix (在项目的根目录中)。
  • 通过npm install删除您的node_modules并重新安装项目根目录中的依赖项

暂无
暂无

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

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