-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Description
What version of Bun is running?
1.3.5
What platform is your computer?
Darwin x86_64 (macOS)
What steps can reproduce the bug?
- Create a new package:
mkdir my-cli && cd my-cli && bun init -y- Update
package.jsonto add a bin entry:
{
"name": "my-cli",
"module": "index.ts",
"type": "module",
"files": ["src"],
"bin": {
"my-cli": "src/cli.ts"
},
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
}
}- Create
src/cli.tswith a shebang:
mkdir src
echo '#!/usr/bin/env bun
console.log("hello");' > src/cli.ts- Register and link globally:
bun link
bun link -g my-cliWhat is the expected behavior?
The binary should be executable:
~/.bun/bin/my-cli # should print "hello"What do you see instead?
The command reports success but shows a FileNotFound error:
bun link v1.3.5 (1e86cebd)
installed my-cli@link:my-cli with binaries:
- my-cli
Failed to install 1 package
[12.00ms] done
FileNotFound: failed linking dependency/workspace to node_modules for package my-cli
The symlink is created at ~/.bun/bin/my-cli, but it points to a non-existent location:
$ ls -la ~/.bun/bin/my-cli
lrwxrwxrwx 1 user staff 48 Dec 29 13:34 /Users/user/.bun/bin/my-cli -> ../install/global/node_modules/my-cli/src/cli.ts
$ ls ~/.bun/install/global/node_modules/my-cli
ls: /Users/user/.bun/install/global/node_modules/my-cli: No such file or directoryThe package is never symlinked into ~/.bun/install/global/node_modules/.
Additional information
Workaround: Manually create the missing symlink:
ln -s /path/to/my-cli ~/.bun/install/global/node_modules/my-cliAfter this, the binary works correctly.
Metadata
Metadata
Assignees
Labels
No labels