Skip to content

'yarn link' for binary global install on Windows results in linked .js file but no .cmd #4772

@mattnathan

Description

@mattnathan

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

What is the current behavior?
yarn link within a project having "bin": {"something": "./index.js"} in the package.json results in a junction being created between \Users\<user>\AppData\Local\Yarn\bin\something and the file <project>\index.js. Unfortunately windows cannot run or does not see this file.

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

Run the following in CMD on Windows

> mkdir yarn-test
> cd yarn-test
> @echo {"name":"yarn-test","version":"1.0.0","license":"MIT","bin":{"boo":"./index.js"}}>package.json
> @echo console.log("Aargh");>index.js
> yarn link
yarn link v1.2.1
success Registered "yarn-test".
info You can now run `yarn link "yarn-test"` in the projects where you want to use this module and it will be used instead.
Done in 0.09s.
> boo
'boo' is not recognized as an internal or external command,
operable program or batch file.
> yarn global bin
C:\Users\<user>\AppData\Local\Yarn\bin
> dir C:\Users\<user>\AppData\Local\Yarn\bin\ | findstr boo
24/10/2017  16:42    <JUNCTION>     boo [C:\Users\<user>\AppData\Local\Yarn\config\link\yarn-test\index.js]

What is the expected behavior?
When yarn global adding a package you get a link and a CMD wrapper for us windows users, yarn link should do the same thing. For example:

> yarn global add yes
...
> yes
y
y
y
...
> dir C:\Users\<user>\AppData\Local\Yarn\bin\ | findstr yes
24/10/2017  16:55               350 yes
24/10/2017  16:55                58 yes.cmd

Please mention your node.js, yarn and operating system version.
yarn: 1.2.1
node: v8.5.0
Windows: Microsoft Windows [Version 10.0.15063]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions