nodeenv falls back to /usr/bin/nodejs instead of the node installed by actions/setup-node
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- github-actions, node.js, typescript
调研方向
先从 actions/setup-node@v4 workflow 和 nodeenv.py 中 931-938 行附近的查找逻辑开始,然后复现链接的 GitHub Actions job 中失败的 pre-commit 运行。跟踪 Ubuntu 托管 runner 上选择了哪个可执行文件;当选择了配置的 Node 16 安装并且 Prettier hook 成功时,该 issue 即完成。
由索引模型根据 Issue 内容生成。
描述
Description:
In a runs-on: ubuntu-latest GitHub hosted runner, I found that even after doing:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16
that pre-commit run -a was failing to run a pre-commit hook configured as:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
args: [--no-editorconfig]
exclude: "^asv\\.conf\\.json$"
exclude_types: [html]
with an error saying:
prettier requires at least version 14 of Node, please upgrade
Which was surprising, seeing as how we had just installed node version 16.
It turns out that pre-commit runs nodeenv, and nodeenv looks first for a binary named nodejs, and then falls back to looking for one named node:
And it seems like actions/setup-node is only installing one named node, and not one named nodejs, so nodeenv found /usr/bin/nodejs first and preferred that over /opt/hostedtoolcache/node/16.20.2/x64/bin/node.
Should the hostedtoolcache contain a nodejs as well? Or perhaps nodeenv should prefer node over nodejs?
Action version:
actions/setup-node@v4
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
Repro steps:
See https://github.com/bloomberg/memray/actions/runs/6984525297/job/19007471664 for a failed run where /usr/bin/nodejs was chosen instead of /opt/hostedtoolcache/node/16.20.2/x64/bin/node
- 主要语言
- TypeScript
- 星标
- 5k
- 派生
- 1.7k
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
actions/setup-node 的其他 Issue
-
feature request
难度 2/5 1-3 小时 新手友好度 65/100
actions/setup-node#1531 · 1 条评论 · 4 个 reaction ·
-
feature request
难度 5/5 一周以上 新手友好度 30/100
actions/setup-node#1634 · 1 条评论 ·
-
actions/setup-node#1628 · 3 条评论 · 已指派 1 人 ·
-
`npm config get cache` fails with `EBADDEVENGINES` when requiring newer npm versions in `devEngines` 未关闭feature request
难度 4/5 3-5 天 新手友好度 52/100
actions/setup-node#1553 · 12 条评论 · 2 个 reaction ·
-
feature request
难度 3/5 1-2 天 新手友好度 38/100
actions/setup-node#1428 · 1 条评论 · 3 个 reaction ·
查看 actions/setup-node 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/claude-code#96687 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/DebateAI#582 · 2 条评论 ·