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

如何修复semantic-release报错:apm CLI必须随semantic-release安装

问题

遇到错误:apm CLI must be installed with semantic-release

ci.yml配置

name: CI

on:
  push:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref }}
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.ref_name == 'main'
    permissions:
      contents: write # to be able to publish a GitHub release
      issues: write # to be able to comment on released issues
      pull-requests: write # to be able to comment on released pull requests
      id-token: write # to enable use of OIDC for npm provenance
    steps:
      - name: ⬇️ 获取最新代码
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: ⬇️ 安装Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 20
          cache: 'npm'
      - name: 📦 安装依赖
        run: npm ci
      - name: 🏗️ 构建项目
        run: npm run build
      - name: ⬆️ FTP上传
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets.FTP_HOST }}
          username: ${{ secrets.FTP_USER }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: ${{ vars.FTP_SOURCE }}
          server-dir: ${{ vars.FTP_DESTINATION }}
      - name: 🚀 执行Semantic Release
        run: npx semantic-release --branches main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

版本信息

{
...
  "@semantic-release/apm-config": "^9.0.1",
  "semantic-release": "^23.1.1",
},
"release": {
  "extends": "@semantic-release/github"
}

补充说明

  • 未添加NPM_TOKEN,因为不需要发布到npm。
  • 尝试过将NPM_TOKEN设为空字符串,问题依旧。

解决方案

报错原因是你安装了@semantic-release/apm-config依赖,但这个包是用于Atom包管理器(apm)的发布配置,而你的release配置只继承了@semantic-release/github,完全不需要apm相关功能。同时GitHub Actions环境默认没有安装apm CLI,所以触发了这个错误。

解决步骤:

  1. 移除@semantic-release/apm-config依赖:
npm uninstall @semantic-release/apm-config
  1. 重新执行npm ci安装依赖,再运行Semantic Release即可。

内容的提问来源于stack exchange,提问作者Raphaël Balet

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 07:35:05