You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo 49.0.11网页编译失败:Webpack Dev Server废弃警告求助

问题:全新Expo SDK 49项目出现Webpack Dev Server弃用警告

我创建了一个未做任何修改的全新Expo项目,但启动时遇到以下弃用警告:

(node:1331) [DEP_WEBPACK_DEV_SERVER_CONSTRUCTOR] DeprecationWarning: Using 'compiler' as the first argument is deprecated. Please use 'options' as the first argument and 'compiler' as the second argument.(Use node --trace-deprecation ... to show where the warning was created)(node:1331) [DEP_WEBPACK_DEV_SERVER_LISTEN] DeprecationWarning: 'listen' is deprecated. Please use the async 'start' or 'startCallback' method.

怀疑是Expo SDK 49新版本的问题,请问该如何解决?
已附上package.json和app.json文件截图。


解决方案
  • 升级Expo相关依赖到最新补丁版本:SDK 49刚发布时可能存在webpack-dev-server适配问题,运行以下命令自动更新依赖:

    npx expo upgrade
    

    该操作会同步升级Expo及关联依赖到SDK 49的最新兼容版本,通常能修复这类兼容性警告。

  • 手动锁定webpack-dev-server兼容版本:如果升级后问题仍存在,可在package.json中指定适配的webpack-dev-server版本(如^4.15.1):

    1. 在package.json的devDependencies中添加:
      "webpack-dev-server": "^4.15.1"
      
    2. 执行npm install或yarn install重新安装依赖。
  • 临时忽略警告:如果警告不影响项目正常运行,可在启动命令中添加参数屏蔽弃用警告:

    NODE_NO_WARNINGS=1 npx expo start
    

    也可以修改package.json的启动脚本:

    "scripts": {
      "start": "NODE_NO_WARNINGS=1 expo start"
    }
    

内容的提问来源于stack exchange,提问作者Michael Menegoi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 12:17:07