klaudiosinani / klaudiosinani/taskbook
`yarn global add taskbook --prefix ~/.local/` failed since tb is not executable
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 393
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I use `yarn global add taskbook --prefix ~/.local/` to install taskbook into `~/.local/bin` sicne it is already in my PATH, and I don't have to add `~/.yarn/bin` to my PATH, but it failed, `tb` is actually installed in `~/.local/bin`, but `tb` command cannot be execueted directly from terminal:
~~~
$ yarn global add taskbook --prefix ~/.local/
yarn global v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "taskbook@0.3.0" with binaries:
- tb
error An unexpected error occurred: "ENOENT: no such file or directory, chmod '/home/username/.local/bin/tb'".
info If you think this is a bug, please open a bug report with the information provided in "/home/username/.config/yarn/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
$ tb
tb: command not found
$ ll ~/.local/bin/tb
lrwxrwxrwx 1 username username 46 Apr 15 10:33 /home/username/.local/bin/tb -> ../../.config/yarn/global/node_modules/.bin/tb
$ ll ~/.config/yarn/global/node_modules/.bin/tb
lrwxrwxrwx 1 username username 18 Apr 15 10:33 /home/username/.config/yarn/global/node_modules/.bin/tb -> ../taskbook/cli.js
$ ll ~/.config/yarn/global/node_modules/taskbook/cli.js
-rwxr-xr-x 1 username username 1.4K Apr 12 18:43 /home/username/.config/yarn/global/node_modules/taskbook/cli.js
$ ~/.config/yarn/global/node_modules/taskbook/cli.js --version
0.3.0
~~~
`yarn global add taskbook` is OK, and `tb` will be installed into `~/.yarn/bin`, and it is executable using `~/.yarn/bin/tb`, but I have to add `~/.yarn/bin` into my PATH if I want to executable `tb` directly.
**Technical Info (please complete the following information)**
- OS: Ubuntu 16.04.3 LTS 64-bit
- Node.js Version: v11.11.0
- Taskbook Version: 0.3.0
If you need `~/.config/yarn/global/yarn-error.log`, please let me know.
---------------
**UPDATE:**
I know it why it doesn't work.
~~~
$ readlink -m ~/.local/bin/tb
/home/username/Dotfiles.d/local/.config/yarn/global/node_modules/.bin/tb
~~~
And `/home/username/Dotfiles.d/local/.config/yarn/global/node_modules/.bin/tb` doesn't exist at all.
Because when I use `yarn` to install taskbook to `~/.local/bin`, it uses the relative path instead of absolute path for symbolic link, as I posted:
~~~
$ ll ~/.local/bin/tb
lrwxrwxrwx 1 username username 46 Apr 15 10:33 /home/username/.local/bin/tb -> ../../.config/yarn/global/node_modules/.bin/tb
$ ll ~/.config/yarn/global/node_modules/.bin/tb
lrwxrwxrwx 1 username username 18 Apr 15 10:33 /home/username/.config/yarn/global/node_modules/.bin/tb -> ../taskbook/cli.js
~~~
But my `~/.local/bin` is a symbolink link of `~/Dotfiles.d/local/.local/bin`
So relative path doesn't work here, since `/home/username/.local/bin/tb -> ../../.config/yarn/global/node_modules/.bin/tb` doesn't work.
I don't know whether this is the problem of `yarn` itself or `taskbook`.
Contributor guide
Research direction
Reproduce the `yarn global add taskbook --prefix ~/.local/` case with a symlinked `~/.local/bin`, then inspect the installed `cli.js` entry point and the generated `.bin/tb` links. Confirm whether the failure is in taskbook's package metadata or Yarn's relative-link handling; done means identifying the owning component and a reproducible fix or clear upstream report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100