Skip to content

Empty "bin" entry in package.json results in ".bin" symlink to directory #6512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rhburrows opened this issue Oct 7, 2018 · 2 comments
Closed

Comments

@rhburrows
Copy link
Contributor

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When yarn installs a dependency that has an empty string as an entry for "bin" in the package.json it creates a symlink to the package's root directory in node_modules/ in the node_modules/.bin directory. An example package configured this way is file-loader

If the current behavior is a bug, please provide the steps to reproduce.

rhburrows$ yarn add file-loader
yarn add v1.10.1
... MORE OUTPUT HERE ...
✨  Done in 0.66s.
rhburrows$ ls -al node_modules/.bin/
total 0
drwxr-xr-x   4 rhburrows  staff  128 Oct  7 09:32 .
drwxr-xr-x  18 rhburrows  staff  576 Oct  7 09:32 ..
lrwxr-xr-x   1 rhburrows  staff   14 Oct  7 09:32 file-loader -> ../file-loader
lrwxr-xr-x   1 rhburrows  staff   19 Oct  7 09:32 json5 -> ../json5/lib/cli.js

What is the expected behavior?

There should be no symlink in node_modules/.bin. That's the result when installing the same dependency with npm.

Please mention your node.js, yarn and operating system version.

Tested on:

  • node 8.11.1 and 10.11.0
  • yarn 1.7 and 1.10.1
  • macOS 10.14
@Gudahtt
Copy link
Member

Gudahtt commented Oct 7, 2018

Thanks for the report!

It looks like this would be simple enough to fix. The module src/util/normalize-manifest/fix.js is normalizing the empty string entry into an object. It should skip this normalization when the entry is an empty string.

Would you be interested in submitting a PR?

@rhburrows
Copy link
Contributor Author

Sure, I'd be happy to take a shot at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants