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

添加SCSS文件后构建失败,resolve-url-loader缺失依赖模块求助

解决resolve-url-loader找不到./lib/value-processor模块的问题

你的问题核心不是Sass本身的问题,而是resolve-url-loader模块安装不完整或版本与Node 18不兼容,导致其内部依赖文件缺失。以下是不用降级Node的解决方案:

  • 彻底清理并重装依赖
    可能是安装过程中resolve-url-loader的文件损坏或缺失,执行以下命令:

    # 删除依赖目录和锁文件
    rm -rf node_modules package-lock.json
    # 重新安装所有依赖
    npm install
    
  • 指定兼容Node 18的resolve-url-loader版本
    如果重装后问题依旧,说明当前项目依赖的resolve-url-loader版本与Node 18不兼容,手动安装适配版本:

    npm install resolve-url-loader@5.0.0 --save-dev
    
  • 升级react-scripts(针对Create React App项目)
    从报错路径看你用的是react-scripts,旧版本的react-scripts可能绑定了不兼容Node 18的resolve-url-loader版本,升级react-scripts到最新适配版:

    npm install react-scripts@latest --save
    

执行完以上步骤后,重新启动项目应该就能正常编译SCSS文件了。

内容的提问来源于stack exchange,提问作者Edgar Leung

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 08:35:20