Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

socket npm cannot execute npm installed via mise

未关闭
#946 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
领域
cli, tooling

调研方向

socket npm 命令的入口开始,使用 mise 生成的 ~/.local/share/mise/installs/node/22.21.1/bin/npm wrapper 复现失败。跟踪 CLI 如何启动请求的可执行文件,然后验证 shell 脚本形式的 npm wrapper 能够被处理,而不会被 Node 当作 JavaScript 解析。该 issue 没有指出任何仓库文件或测试,因此完成时应包含针对此调用的回归检查。

由索引模型根据 Issue 内容生成。

描述

bug

mise puts node and npm file pointing like ~/.local/share/mise/installs/node/22.21.1/bin/npm
which is a shell script :(

#!/usr/bin/env bash
set -euo pipefail

# This script wraps npm so to run `mise reshim` after global installs and uninstalls
# Any other cases are passed-through to npm

this_dir=$(dirname "${BASH_SOURCE[0]}")
plugin_name=$(basename "$(dirname "$this_dir")")

this_dir=$(cd "$this_dir" && pwd -P) # Normalizes the directory
...

So socket npm fails because it isn't a node script.

$ socket npm i
   _____         _       _        /---------------
  |   __|___ ___| |_ ___| |_      | CLI: v1.1.38
  |__   | . |  _| '_| -_|  _|     | token: (not set), org: (not set)
  |_____|___|___|_,_|___|_|.dev   | Command: `socket npm`, cwd: **

/Users/kesoji/.local/share/mise/installs/node/22.21.1/bin/npm:2
set -euo pipefail
         ^^^^^^^^

SyntaxError: Unexpected identifier 'pipefail'
    at wrapSafe (node:internal/modules/cjs/loader:1638:18)
    at Module._compile (node:internal/modules/cjs/loader:1680:20)
    at Object..js (node:internal/modules/cjs/loader:1839:10)
    at Module.load (node:internal/modules/cjs/loader:1441:32)
    at Function._load (node:internal/modules/cjs/loader:1263:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49

Node.js v22.21.1

Is there any solution or workaround?

主要语言
TypeScript
星标
317
派生
65
平均合并
1 小时 26 分钟
30 天内合并 PR
30

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SocketDev/socket-cli 的其他 Issue

查看 SocketDev/socket-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。