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

Ember.js 5.8本地npm依赖问题:自定义ESLint插件构建报错排查

问题原因

ember-cli-dependency-checker 默认会验证项目依赖是否在 npm 官方 registry 上存在记录,而你用 file:./config/eslint 引入的本地未发布插件,并不在 npm registry 里,所以工具误判这个包未安装,触发报错。

解决方案

有两种可行的处理方式:

方式一:让 dependency-checker 忽略该包

在项目根目录的 ember-cli-build.js 中,修改 dependencyChecker 的配置,把你的本地插件加入忽略列表:

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    dependencyChecker: {
      excluded: ['eslint-plugin-acme']
    }
  });

  // 其他项目配置...

  return app.toTree();
};

修改后重新执行 npx ember build,工具就会跳过对这个包的验证。

  1. 进入本地插件所在目录 ./config/eslint,执行:
    npm link
    
  2. 回到项目根目录,执行:
    npm link eslint-plugin-acme
    

这种方式会把本地插件链接到项目的 node_modules 中,dependency-checker 会识别为正常安装的依赖,不会再报错。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 17:20:55