gpt4 book ai didi

Bitbucket 管道 - 安装预提交 ts-lint 时出错

转载 作者:行者123 更新时间:2023-12-05 01:23:44 25 4
gpt4 key购买 nike

我的管道中有一个步骤在 Bitbucket 上运行我们配置的预提交:

...
- step:
name: Passing linters
image: python:3.7-slim-stretch
script:
- pip3 install "pre-commit==2.17.0"
- apt-get update && apt-get --assume-yes install git
- pre-commit run --all-files

没有进行任何更改,但它突然停止工作。

流水线结果:

+ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/psf/black:click==8.0.4.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/:tslint-react@4.1.0,tslint@5.20.1,typescript@4.0.2.
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/maximevast/pre-commit-tslint/.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/root/.cache/pre-commit/repo1234/node_env-default/bin/node', '/root/.cache/pre-commit/repo1234/node_env-default/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
expected return code: 0
stdout: (none)
stderr:
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)

Check the log at /root/.cache/pre-commit/pre-commit.log

最佳答案

pre-commit 利用 nodeenv 引导节点环境

它通过下载 node 的副本并配置环境(当 node 不可用时)来实现。几天前发布了 node 18.x,预构建的二进制文件需要相对较新版本的 glibc

有几种方法可以解决这个问题:

1。使用 language_version 选择特定版本的 node/default_language_version

# using default_language_version
default_language_version:
node: 16.14.2

# on the hook itself
repos:
- repo: https://github.com/maximevast/pre-commit-tslint
rev: ...
hooks:
- id: tslint
language_version: 16.14.2

2。使用更新的基础镜像

stretch 有点老了,也许试试用 3.7-slim-buster 代替?

这会给你一个更现代的 glibc 版本

    image: python:3.7-slim-buster

3。将 node 安装到你的镜像中

这将默认跳过预提交的“下载节点”步骤(具体来说,当检测到合适的节点时,它将默认为language_version: system)

这将根据您的图像设置而有所不同


免责声明:我创建了预提交

关于Bitbucket 管道 - 安装预提交 ts-lint 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71939099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com