【问题标题】:Upgraded Gatsby and Now Getting BABEL Error -Package exports do not define a '.' subpath升级了 Gatsby,现在出现 BABEL 错误 - 包导出未定义“。”子路径
【发布时间】:2020-01-13 10:04:19
【问题描述】:

错误 #98123 网页包

[BABEL] .cache\develop-static-entry.js: 包导出 '\node_modules@babel\helper-compilation-targets' 没有定义 '.' 子路径

尝试升级 NPM 并清理 NPM 缓存,但这不起作用。

gatsby升级之前,没有这个问题

盖茨比信息

  System:
    OS: Windows 10 10.0.18362
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 13.0.1 - C:\Program Files\nodejs\node.EXE
    npm: 6.13.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    gatsby: ^2.18.21 => 2.18.21
    gatsby-cli: ^2.8.26 => 2.8.26
    gatsby-image: ^2.2.38 => 2.2.38
    gatsby-plugin-canonical-urls: ^2.1.19 => 2.1.19
    gatsby-plugin-config: ^1.0.7 => 1.0.7
    gatsby-plugin-google-analytics: ^2.1.32 => 2.1.32
    gatsby-plugin-gtag: ^1.0.12 => 1.0.12
    gatsby-plugin-metomic: 0.0.2 => 0.0.2
    gatsby-plugin-playground: ^1.0.6 => 1.0.6
    gatsby-plugin-react-head: ^1.1.0 => 1.1.0
    gatsby-plugin-s3: ^0.2.5 => 0.2.5
    gatsby-plugin-sass: ^2.1.27 => 2.1.27
    gatsby-plugin-sharp: ^2.3.13 => 2.3.13
    gatsby-plugin-sitemap: ^2.2.25 => 2.2.25
    gatsby-remark-images: ^3.1.42 => 3.1.42
    gatsby-remark-relative-images: ^0.2.3 => 0.2.3
    gatsby-source-filesystem: ^2.1.46 => 2.1.46
    gatsby-transformer-remark: ^2.6.48 => 2.6.48
    gatsby-transformer-sharp: ^2.3.12 => 2.3.12

【问题讨论】:

  • 注意:使用 Gatsby BUILD 时,错误仅略有不同:错误 #98123 WEBPACK 生成 JavaScript 包失败 [BABEL] \.cache\production-app.js: '\node_modules\ 的包导出@babel\helper-compilation-targets' 没有定义 '.'子路径

标签: babeljs gatsby static-site


【解决方案1】:

只需将node升级到v12.14.1或更高版本,问题就会得到解决。

【讨论】:

    【解决方案2】:

    请注意,您需要升级到babel v7.8.4nodejs 13.6.0。详情请见Error: Package exports for <path to project folder>/node_modules/@babel/helper-compilation-targets' do not define a '.' subpath

    如果你升级nodejs那么请记得清除你的缓存:

    $ rm -rf node_modules
    $ rm package-lock.json yarn.lock
    $ npm cache clear --force
    $ npm install 
    $ npm run dev
    

    【讨论】:

      【解决方案3】:

      在查看链接问题的基础上采取了一些步骤:

      1. 升级节点
      2. 删除项目中的Node_Modules文件夹
      3. 在项目中运行 npm install

      然后我又开始做生意了。感谢回复

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-12-30
        • 2017-02-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-03-27
        • 1970-01-01
        • 2019-04-27
        相关资源
        最近更新 更多