circleci中的语义释放命令会抛出有关execa的错误

问题描述 投票:0回答:1

我正在尝试将软件包发布到npm。当CircleCI尝试运行semantic-release时,它将引发以下错误:

/home/circleci/src/node_modules/semantic-release/node_modules/execa/index.js:18
    const env = extendEnv ? {...process.env, ...envOption} : envOption;
                             ^^^

SyntaxError: Unexpected token ...

    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:511:25)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/circleci/src/node_modules/semantic-release/bin/semantic-release.js:9:13)
    at Module._compile (module.js:541:32)
npm ERR! code ELIFECYCLE

我的package.json devDependencies如下:

  "devDependencies": {
    "@semantic-release/changelog": "^5.0.1",
    "@semantic-release/commit-analyzer": "^8.0.1",
    "@semantic-release/git": "^9.0.0",
    "@semantic-release/github": "^7.0.7",
    "@semantic-release/npm": "^7.0.5",
    "@semantic-release/release-notes-generator": "^9.0.1",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.3",
    "jest": "^25.5.1",
    "marked": "^0.4.0",
    "npm-audit-resolver": "^2.2.0",
    "prettier": "^2.0.5",
    "semantic-release": "^16.0.4",
    "semantic-release-cli": "^5.3.1"
  },

我已经在CircleCI中为github和npm设置了环境变量,并在我的CircleCI配置文件中使用了它们。在CircleCI配置中运行npm ci之前,我还具有semantic-release步骤。

想知道是否有人遇到此问题并解决了吗? (如果需要,我可以提供更多信息。)

node.js circleci semantic-release
1个回答
0
投票
最后,我检查了我的CircleCI执行器的Nodejs版本(node --version),它是机器执行器(image: ubuntu-1604:201903-01)。我发现该执行程序中的节点版本太旧(v6.x.x)。我需要机器执行程序来运行测试,因为我不得不通过机器上运行的其他Docker映像来模拟一些AWS功能。但是,可以在release步骤将执行程序更改为Nodejs docker执行程序。因此,我做到了,问题得以解决。

例如,我在CircleCI配置的开头添加了以下内容:

version: 2.1 default_executor: &default_executor working_directory: ~/repo machine: image: ubuntu-1604:201903-01 release_executor: &release_executor working_directory: ~/repo docker: - image: circleci/node:10.18

然后,在release步骤中,我在运行npm run semantic-release之前执行了此操作:

  release:
    <<: *release_executor

© www.soinside.com 2019 - 2024. All rights reserved.