javascript - 错误 #98123 WEBPACK 在 `gatsby develop` 上生成开发 JavaScript 包失败
问题描述
我运行了以下命令来创建一个新的 gatsby 入门博客:
gatsby new blog https://github.com/alxshelepenok/gatsby-starter-lumen
cd blog
gatsby develop
但是在此期间gatsby develop
,我收到了很多错误,名为ERROR #98123 WEBPACK
“ 生成开发 JavaScript 捆绑包失败”。
我已经尝试了很长时间,一次又一次地删除并安装了回购协议,然后又删除了node_modules
,package-lock.json
然后npm install
又出现了同样的错误。帮帮我!
有关详细信息,这是我收到的错误的完整列表(有点长):
套餐:
node v10.19.0
npm 6.14.4
OS: Ubunut 20.04LTS
"gatsby": "^2.31.1",
"gatsby-cli": "^2.18.0",
"gatsby-link": "^2.10.0",
"gatsby-plugin-catch-links": "^2.9.0",
"gatsby-plugin-feed": "^2.12.0",
"gatsby-plugin-flow": "^1.9.0",
"gatsby-plugin-google-gtag": "^2.7.0",
"gatsby-plugin-manifest": "^2.11.0",
"gatsby-plugin-netlify": "^2.10.0",
"gatsby-plugin-netlify-cms": "^4.9.0",
"gatsby-plugin-offline": "^3.9.0",
"gatsby-plugin-optimize-svgs": "^1.0.5",
"gatsby-plugin-react-helmet": "^3.9.0",
"gatsby-plugin-sass": "^3.1.0",
"gatsby-plugin-sharp": "^2.13.1",
"gatsby-plugin-sitemap": "^2.11.0",
"gatsby-remark-autolink-headers": "^2.10.0",
"gatsby-remark-copy-linked-files": "^2.9.0",
"gatsby-remark-external-links": "0.0.4",
"gatsby-remark-images": "^3.10.0",
"gatsby-remark-katex": "^3.9.0",
"gatsby-remark-prismjs": "^3.12.0",
"gatsby-remark-relative-images": "^2.0.2",
"gatsby-remark-responsive-iframe": "^2.10.0",
"gatsby-remark-smartypants": "^2.9.0",
"gatsby-source-filesystem": "^2.10.0",
"gatsby-transformer-remark": "^2.15.0",
"gatsby-transformer-sharp": "^2.11.0",
```
解决方案
这些问题是不言自明的:
/home/myPC/Documents/blog/src/components/Feed/Feed.js
4:13 error Parsing error: Unexpected token {
✖ 1 problem (1 error, 0 warnings)
File: src/components/Feed/Feed.js
/home/myPC/Documents/blog/src/components/Icon/Icon.js
5:6 error Parsing error: Unexpected token Props
✖ 1 problem (1 error, 0 warnings)
File: src/components/Icon/Icon.js
等等...
正如您在他们的存储库中看到的那样,您必须使用 yarn 而不是 npm,因为依赖项是使用yarn.lock
文件锁定的。
所以,删除你的node_modules
,你的cache
文件夹并运行yarn install
(你可能需要先安装它)。
推荐阅读
- c++ - C++ 事件系统 - 多态事件和事件处理程序
- android - 我想让这个日期选择器透明
- sql - 从 Excel 文件中的数据生成 SQL INSERT
- node.js - 如何使用 Chrome DevTools 在 goormIDE 中调试 Node.js 应用程序?
- ios - 获取 UITextField 安全文本的宽度
- javascript - 在文件上传器 Javascript 上检测损坏的文件
- python-3.x - 是否可以在 Python (Spyder) 中更新内联图?
- java - 使用自定义比较器会导致排序不一致
- android - Main Activity toolbar not showing after hiding when attaching fragment
- echarts - 如何使用 Echarts 在散点图上绘制圆形图层