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

使用@supabase/supabase-js时遇无法解析'encoding'模块的非中断警告求助

使用@supabase/supabase-js时出现"Can't resolve 'encoding'"非中断警告的解决办法

这个警告是因为node-fetch依赖的encoding包未被安装,而cross-fetch依赖node-fetch,最终通过supabase-js的依赖链触发了模块找不到的警告——虽然不影响项目运行,但确实看着碍眼。

解决办法很直接:

  • 安装缺失的encoding包:

    npm install encoding
    # 用yarn的话执行
    yarn add encoding
    
  • 如果装完还能看到警告,试试清理缓存后重装依赖:

    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install
    
  • 要是你用的是Next.js(从路径里的app/[lng]/page.jsx能看出来),也可以通过配置webpack忽略这个警告,但更推荐直接安装依赖的方式:

    module.exports = {
      webpack: (config) => {
        config.resolve.fallback = {
          ...config.resolve.fallback,
          encoding: false,
        };
        return config;
      },
    };
    

内容的提问来源于stack exchange,提问作者Max Silva

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.28 10:55:00