首页 > 解决方案 > 错误 #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_modulespackage-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",
    ```


标签: javascriptnode.jsnpmwebpackgatsby

解决方案


这些问题是不言自明的:

/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(你可能需要先安装它)。


推荐阅读