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

本地ESLint插件导致CI环境npm安装依赖失败问题排查

本地自定义ESLint插件在CI环境安装失败问题

我在当前项目目录内创建了一个未发布的自定义ESLint插件,本地使用毫无问题,但在CI环境执行npm ci或npm i时,无法正常完成依赖安装,报错显示找不到node_modules/eslint-plugin-telo/package.json。

CI报错详情

$ npm ci && npm run build:mfe
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /builds/teleoptometry/telo-ui/node_modules/eslint-plugin-telo/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/builds/teleoptometry/telo-ui/node_modules/eslint-plugin-telo/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-07-14T10_31_53_477Z-debug.log

相关配置

.eslintrc.js

module.exports = {
  extends: ['react-app'],
  plugins: ['react-hooks', 'telo'], // telo是自定义插件名
  rules: {
    [...other rules...]
    'telo/use-telo-navigate': 'error', // 自定义规则
  },
}

package.json

"devDependencies": {
  "eslint-plugin-telo": "file:./eslint"
}

自定义插件结构

插件存放在项目根目录的eslint文件夹下,结构如下:

eslint/
├── index.js
└── rules/
    └── use-telo-navigate.js

./eslint/index.js

module.exports = {
  rules: { 'use-telo-navigate': require('./rules/use-telo-navigate') },
}

我怀疑问题出在package.json中引用ESLint插件的方式,但不明白为什么本地能正常运行。我不想把这个插件单独提取到新仓库(当前项目并非monorepo架构),希望能调整现有配置解决问题,请问我哪里做错了?

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 15:15:13