Skip to content

[Bug]: Plugin install on windows #392

@abin30

Description

@abin30

Description

在win下安装插件失败,看代码应该是在路径转换问题。

Steps to Reproduce

  1. 在win下运行 opencli plugin install github:ByteYue/opencli-plugin-hot-digest
  2. 提示安装成功,但实际无法使用。
  3. 每次运行opencli 都会提示:
    ⚠ Plugin hot-digest/aggregate.ts: Unknown file extension ".ts" for C:\Users\WSB.opencli\plugins\hot-digest\aggregate.ts

目前发现了几个问题:

  1. plugin.ts 中,两个地方的:
    const thisFile = new URL(import.meta.url).pathname
    建议换为:
    const thisFile = fileURLToPath(import.meta.url);

  2. 在win下跨磁盘创建链接需要管理员权限,负责会失败,这个函数需要修正下:linkHostOpencli

  3. node 无法正确加载 .ts 文件,目前好像没有解决完全:
    (1) 目前报这个错误,不确定什么原因
    Failed to transpile aggregate.ts: spawnSync D:\code\opencli\node_modules.bin\esbuild ENOENT

  4. 建议在discovery.ts 中将discoverPluginDir 中对.ts 文件的支持取消。

Expected Behavior

修正此Bug

OpenCLI Version

1.3

Node.js Version

22.x

Operating System

Windows

Logs / Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions