-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yarn run doesn't find bin scripts when using Plug and Play on Windows #6493
Comments
I can also reproduce the bin file fail. Note: Just to narrow the scope I confirmed basic functionality of Update: The map path in the "../../Users/jdalton/AppData/Local/Yarn/Cache/v3/npm-eslint-5.6.1-348134e32ccc09abb2df1bf282b3f6eed8c7b480/node_modules/eslint/" Update: I tried running with "installConfig": {
"pnp": false
}, and Update: I made it to [ 'C:\\Users\\jdalton\\AppData\\Local\\Yarn\\bin',
'C:\\Users\\jdalton\\.yarn\\bin' ] |
Yep, this seems definitely related to #6450. It's going to be annoying, we'll likely have to bump the cache version to fix it (only on Windows, fortunately). The faulty logic is likely there: Line 705 in e905f74
Which is called here: yarn/src/fetchers/base-fetcher.js Line 80 in e905f74
It's interesting: while this code has changed lately, it always used to create junction points on Windows. Was it already broken before, or is it a recent regression? |
I'm presuming the issue is that yarn/src/util/generate-pnp-map.js Line 290 in 1b78b1a
yarn/src/fetchers/base-fetcher.js Line 80 in 1b78b1a
When the implementation uses Lines 703 to 705 in e905f74
Compare to this case, which on Windows uses Lines 34 to 45 in 1b78b1a
|
The And now I remember: it's not a regression because we weren't creating the |
I tried replacing the
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../bin/eslint.js" "$@"
ret=$?
else
node "$basedir/../bin/eslint.js" "$@"
ret=$?
fi
exit $ret
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\bin\eslint.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\bin\eslint.js" %*
) cmd-shim does support an (undocumented) It seems like |
I'm not sure that's true - we should check, but the |
That said, the Btw, we have a |
Now what I don't understand is that the generated scripts should work even without the
So the last step seems to be failing ... curious ... |
Adding
Inspecting that directory (is it expected that the temporary directory isn't cleaned up after the lifecycle script ends?), shows:
#!/bin/sh
"C:\Program Files\nodejs\node.exe" "-r" "C:\Users\Ed\src\test-react-neutrino9-beta0/.pnp.js" "$@"
#!/bin/sh
"C:\Program Files\nodejs\node.exe" "C:\Program Files (x86)\Yarn\bin\yarn.js" "$@" However the That said, I very rarely use cmd and instead use MSYS2 (checking out WSL is still on my "when I have time or get a laptop refresh" list), so perhaps I can avoid this for now locally by just overriding the shell using |
Correction, it only refers to Adding
But as expected, running the former gives:
(I guess the cmd.exe's |
Repeating the STR in the issue description with Yarn 1.12.3 (ie with the fix in #6621), I now get:
...even though Edit: Though perhaps sounds like #6557? |
I've just merged #6495 which includes various fixes for Windows. I think it'll land with the 1.13 (~2-3 weeks), but in the meantime it will soon be available through our nightly builds. |
The STR in comment 0 now succeed :-)
However trying against an existing project I've hit several more issues that I think mean it won't be possible for us to use it for the project I had in mind sadly (non platform portable paths in |
(I'll open some new issues for the other items) |
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:If the current behavior is a bug, please provide the steps to reproduce.
package.json
: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:
cmd.exe
yarn lint
, I call the package directly (ie not ascripts
command), I get a more informative error message:.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):The text was updated successfully, but these errors were encountered: