-
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 no longer works on windows with executables not mentioned in package.json/scripts #3773
Comments
Hm, we do have a test to check this, and it seems to be passing, even on Windows :/ Does anybody reproduce this? I can't make this happen on OSX. |
This appears to only be an issue when there are additional arguments passed. |
Same here: |
Ran into this when I upgraded from 0.26.1 to 0.27.0 (also seeing this on 0.27.5) My hunch is that this release comment has something to do with it
|
From what I understand, the issue appeared with #3627, but was somehow hidden in the code earlier. It can be reproduced on Windows with a test on /* @flow */
import Config from '../../src/config.js';
import {executeLifecycleScript} from '../../src/util/execute-lifecycle-script.js';
test('executeLifecycleScript', async () => {
const config = await Config.create();
const cwd = __dirname;
const cmd = '"node" "--version"';
await executeLifecycleScript('test', config, cwd, cmd);
// Will throw an exception on Windows
}); Looking at the code, I don't understand why we need to process and concatenate the arguments, because |
|
Because the script can have multiple arguments, ie: {
"scripts": {
"foobar": "some-utility --some-opt-a --some-opt-b"
}
} So if we were to use the version of We'll add a test and try to fix this one, thanks! |
I just upgraded to Yarn 0.27.5 on Windows, and am now experiencing the same issue. When I run: I get:
This worked previously to run gulp and pass the task for gulp to run. |
@arcanis any updates? This is a major issue for those of us on windows, this should be flagged as high priority and hopefully not triaged. |
Since fixing this bug requires a working Windows machine I haven't been able to check it yet. We will eventually do it, but it would help us a lot and would be faster if a Windows user could submit a PR. |
Facebook doesn't have Windows Dev VMs? |
I made a pull request with a fix at #4031. I tested it on my Windows and a linux VM. For testing, checkout the branch, then: yarn install
yarn build
#Windows
.\bin\yarn run gulp -- --version
.\bin\yarn run lint
.\bin\yarn run eslint
#Mac/linux
./bin/yarn run gulp -- --version
./bin/yarn run lint
./bin/yarn run eslint Thanks |
We do, it just takes you out of your normal flow and Yarn is almost exclusively run on macOS and Linux. That said I'm hoping to change this soon, it just takes time. |
**Summary** Fix for #3773 > Yarn run no longer works on windows with executables not mentioned in package.json/scripts **Test plan** I think we don't have automated tests for this case, it's OS specific and the fix relies on the `shell` option of `child_process.spawn`, so we cannot use mock to reliably test this issue. (Any idea welcomed) I ran manual tests on Windows 10 and a Linux VM.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When running executable, that is not mentioned in scripts section of package.json using
yarn run
, yarn failsIf the current behavior is a bug, please provide the steps to reproduce.
Adding grunt to scripts resolves an issue
What is the expected behavior?
Worked fine in v0.24.6
Please mention your node.js, yarn and operating system version.
Yarn version: 0.27.3
Node version: 7.10.0
Platform: win32 x64 (Windows 10)
The text was updated successfully, but these errors were encountered: