【问题标题】:Gatsby installation in Windows在 Windows 中安装 Gatsby
【发布时间】:2021-03-06 04:53:45
【问题描述】:

我正在使用 Windows 10。 我正在尝试安装 gatsby,我以为我做到了,但是当我在 VM 代码中运行 gatsby -v 时,出现了问题。

/mnt/c/Users/mmkob/AppData/Roaming/npm/node_modules/gatsby-cli/node_modules/prettier/third-party.js:9863
      for await (const place of this.config.searchPlaces) {
          ^^^^^

SyntaxError: Unexpected reserved word
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/mnt/c/Users/mmkob/AppData/Roaming/npm/node_modules/gatsby-cli/node_modules/prettier/index.js:16652:18)

我不太确定如何处理这个问题。如果有任何帮助,我将不胜感激。

【问题讨论】:

    标签: node.js reactjs windows graphql gatsby


    【解决方案1】:

    将您的 Node 版本更新到 v10。正如您在for await...of docs 中看到的,for await (const place of this.config.searchPlaces) 语法在大于10.0.0 的版本中可用。

    【讨论】:

      【解决方案2】:

      您可以使用 nvm use 切换到更高版本的节点。就我而言,我切换到 14.16。因此,如果您安装了 nvm,请使用 14.16。您应该安装高于 10.0.0 的版本

      【讨论】:

        猜你喜欢
        • 2019-10-06
        • 2017-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-14
        • 1970-01-01
        • 1970-01-01
        • 2013-09-25
        相关资源
        最近更新 更多