-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
yarn run
fails to find packages' bin scripts when using plug and play mode on Windows, instead giving:
C:\Users\Ed\src\testcase-yarn-pnp-windows>yarn lint
yarn run v1.12.0
warning package.json: No license field
$ eslint --version
'eslint' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If the current behavior is a bug, please provide the steps to reproduce.
- Create an empty directory containing this
package.json
:
{
"installConfig": {
"pnp": true
},
"dependencies": {
"eslint": "^5.6.1"
},
"scripts": {
"lint": "eslint --version"
}
}
yarn --pnp
yarn lint
What is the expected behavior?
ESLint is found and outputs its version.
Please mention your node.js, yarn and operating system version.
Yarn 1.12.0, Node 10.11.0, Windows 10 x64
Other:
- This reproduced for me inside both an MSYS2 bash shell and when using native
cmd.exe
- The same error occurred using something other than eslint (eg jest)
- If instead of running
yarn lint
, I call the package directly (ie not ascripts
command), I get a more informative error message:
yarn eslint --version
yarn run v1.12.0
warning package.json: No license field
$ C:\Users\Ed\AppData\Local\Yarn\Cache\v3\npm-eslint-5.6.1-348134e32ccc09abb2df1bf282b3f6eed8c7b480\node_modules\eslint\.bin\eslint --version
'C:\Users\Ed\AppData\Local\Yarn\Cache\v3\npm-eslint-5.6.1-348134e32ccc09abb2df1bf282b3f6eed8c7b480\node_modules\eslint\.bin\eslint'
is not recognized as an internal or external command, operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
- Inspecting the contents of the
.bin
directory in that error message, showseslint
to be a junction (so related to Yarn on Windows creates invalid junctions to files (junctions are not allowed to files, only directories) #6450? Though that issue doesn't appear to be about PnP):
01/10/2018 17:11 <JUNCTION> eslint [C:\Users\Ed\AppData\Local\Yarn\Cache\v3\npm-eslint-5.6.1-348134e32ccc09abb2df1bf282b3f6eed8c7b480\node_modules\eslint\bin\eslint.js]
- Trying to open the junction in Windows Explorer gives:
C:\Users\Ed\AppData\Local\Yarn\Cache\v3\npm-eslint-5.6.1-348134e32ccc09abb2df...\eslint
is not accessible.
The directory name is invalid.
- MSYS2 reports it as a symlink to a non-existent directory rather than a file (note the trailing slash):
lrwxrwxrwx 1 Ed None 132 Oct 1 17:11 eslint -> /c/Users/Ed/AppData/Local/Yarn/Cache/v3/npm-eslint-5.6.1-348134e32ccc09abb2df1bf282b3f6eed8c7b480/node_modules/eslint/bin/eslint.js/