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

OroCommerce 5.1执行assets:install时underscore模块未找到错误

OroCommerce 5.1 执行oro:assets:install命令时出现Underscore模块找不到异常

环境与问题概述

使用OroCommerce 5.1框架,按官方文档完成前期配置后一切正常,但执行以下命令安装资产时出现异常:

php bin/console oro:assets:install --env=dev

已尝试过以下操作,均未解决问题:

  • 更新项目代码
  • 重新安装所有依赖包
  • 修改webpack.config.js配置

具体报错信息

PublicPath: /build/admin/
  assets by status 13.6 MiB [cached] 281 assets

  ERROR in ./bundles/oroui/js/extend/underscore.js
  Module not found: Error: Package path ./underscore is not exported from package /Users/user/VHost/oroTest/node_modules/underscore (see exports field in /Users/user/VHost/oroTest/node_modules/underscore/package.json)
  Did you mean './underscore'?
  Requests that should resolve in the current directory need to start with './'.
  Requests that start with a name are treated as module requests and resolve within module directories (/Users/user/VHost/oroTest/public/build/admin/, /Users/user/VHost/oroTest/public, /Users/user/VHost/oroTest/assets, /Users/user/VHost/oroTest/public/bundles, /Users/user/VHost/oroTest/public/js, /Users/user/VHost/oroTest/node_modules).
  If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
   @ ./bundles/oroui/js/app.js 15:14-35

  admin.oro theme compiled with 1 error in 95717 ms

default theme:
  PublicPath: /build/default/
  assets by status 4.65 MiB [cached] 40 assets

  ERROR in ./bundles/oroui/js/extend/underscore.js
  Module not found: Error: Package path ./underscore is not exported from package /Users/user/VHost/oroTest/node_modules/underscore (see exports field in /Users/user/VHost/oroTest/node_modules/underscore/package.json)
  Did you mean './underscore'?
  Requests that should resolve in the current directory need to start with './'.
  Requests that start with a name are treated as module requests and resolve within module directories (/Users/user/VHost/oroTest/public/build/default/, /Users/user/VHost/oroTest/public, /Users/user/VHost/oroTest/assets, /Users/user/VHost/oroTest/public/bundles, /Users/vincentorru/VHost/oroTest/public/js, /Users/user/VHost/oroTest/node_modules).
  If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
   @ ./bundles/oroui/js/app.js 15:14-35

  default theme compiled with 1 error in 78195 ms

custom theme:
  PublicPath: /build/custom/
  assets by status 4.19 MiB [cached] 35 assets

  ERROR in ./bundles/oroui/js/extend/underscore.js
  Module not found: Error: Package path ./underscore is not exported from package /Users/vincentorru/VHost/oroTest/node_modules/underscore (see exports field in /Users/vincentorru/VHost/oroTest/node_modules/underscore/package.json)
  Did you mean './underscore'?
  Requests that should resolve in the current directory need to start with './'.
  Requests that start with a name are treated as module requests and resolve within module directories (/Users/vincentorru/VHost/oroTest/public/build/custom/, /Users/vincentorru/VHost/oroTest/public, /Users/vincentorru/VHost/oroTest/assets, /Users/vincentorru/VHost/oroTest/public/bundles, /Users/vincentorru/VHost/oroTest/public/js, /Users/vincentorru/VHost/oroTest/node_modules).
  If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
   @ ./bundles/oroui/js/app.js 15:14-35

  custom theme compiled with 1 error in 79959 ms

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.01 17:05:59