Skip to content

Conversation

Copy link

Copilot AI commented Dec 26, 2025

Packages with "bin": "" or "bin": {"cmd": ""} in package.json fail installation with "Failed to ensure binary is executable". The parser creates bin entries for empty paths, which later resolve to the package directory itself when joined, causing the executable check to fail on a directory.

Changes

  • String bin values: Return empty vector when path is empty
  • Object bin values: Use filter_map to skip entries with empty path values
  • Tests: Added coverage for both empty string and mixed empty/valid object cases
// Before: Created bin entry for empty string
vec![(name.clone(), "")]  // Resolves to package directory

// After: Skip empty paths entirely
if bin_path.is_empty() {
    Vec::new()
} else {
    vec![(name.clone(), bin_path)]
}

This matches cnpm behavior and allows legacy packages with empty bin fields to install successfully.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • github.com (HTTP Only)
    • Triggering command: /usr/bin/ssh /usr/bin/ssh -o SendEnv=GIT_PROTOCOL [email protected] git-upload-pack 'utooland/next.js.git' (packet block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Utoo PM] 依赖如果有空 bin 会安装失败</issue_title>
<issue_description>### What happened?

Image

失败的依赖:

{
  "name": "test-dep",
  "version": "1.0.0"
  "bin": ""
}

Expected result

祖传依赖,过去7、8年没有变更了,cnpm 安装正常,希望 utoo 能让这个依赖也正常</issue_description>

<agent_instructions>解决 package.json 里 bin 设置为空字符串时(bin: ""),ut install 报错的问题,报错信息为 Failed to ensure binary is executable</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix error when bin is an empty string in dependencies Fix installation failure for packages with empty bin field Dec 26, 2025
Copilot AI requested a review from afc163 December 26, 2025 04:16
@elrrrrrrr
Copy link
Contributor

@copilot fix ci

Copy link
Author

Copilot AI commented Dec 26, 2025

@copilot fix ci

The CI for this PR is passing successfully (workflow run #20515715018 completed with success status). The fix has been implemented in commit 6f0b428 to filter out empty bin paths during package.json parsing, preventing the "Failed to ensure binary is executable" error.

Copilot AI requested a review from elrrrrrrr December 26, 2025 05:04
@xusd320 xusd320 force-pushed the next branch 2 times, most recently from f77808c to 567e5ae Compare January 7, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Utoo PM] 依赖如果有空 bin 会安装失败

3 participants