【问题标题】:Getting Webpack invalidation error when trying to start expo dev server尝试启动 expo 开发服务器时出现 Webpack 失效错误
【发布时间】:2023-01-14 00:54:55
【问题描述】:

我运行 npm run start 然后按 w 打开 web,但是我得到了这个:

    Logs for your project will appear below. Press Ctrl+C to exit.
Starting Webpack on port 19006 in development mode.
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.node should be one of these:
   false | object { __dirname?, __filename?, global? }
   -> Include polyfills or mocks for various node stuff.
   Details:
    * configuration.node has an unknown property 'module'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'dgram'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'dns'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'fs'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'http2'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'net'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'tls'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'child_process'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.

任何人都知道可能导致这种情况的原因以及任何可能的解决方案?

我已经用谷歌搜索了几个小时,但没有找到任何帮助。

【问题讨论】:

    标签: webpack expo


    【解决方案1】:

    这个问题可能是因为 webpack 版本不匹配导致的。确保您的 webpack 版本与 @expo/webpack-config 使用的完全相同。

    例如。这种软件包组合为我解决了这个问题:

    "@expo/webpack-config": "^0.17.2",
    "webpack": "4.43.0",
    "webpack-cli": "4.10.0",
    "webpack-dev-server": "3.11.0"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      相关资源
      最近更新 更多