What is the current behavior?
I have a script as follows in package.json
"css-prod": "node-sass --output-style compressed --precision 10 --output webroot/css src/scss/main.scss"
Running the above script using yarn run css-prod works fine, however if I add postcss-cli to the devDependencies using yarn add postcss-cli -dev the console prints the path to postcss and hangs.
What is the expected behavior?
Regardless of if postcss is in the devDependencies, this task should complete without logging the path of postcss
Please mention your node.js, yarn and operating system version.
Node: 7.4.0
Yarn: 0.18.1
Operating System: Windows 10
I think I do have the same problem here:
Inside package.json I have the following three scripts:
"css": "npm-run-all css:*",
"css:production": "postcss -o Public/assets/default.css Styleguide/Default.css",
"css:debug": "postcss -o Public/assets/debug.css Styleguide/Debug.css",
Running this through yarn will display the following result and does not exit successfully:
$ yarn run css
yarn run v0.21.3
$ npm-run-all css:*
> *********@0.0.0 css:production /Users/tobias/Sites/*********
> postcss -o Public/assets/default.css Styleguide/Default.css
> *********@0.0.0 css:debug /Users/tobias/Sites/*********
> postcss -o Public/assets/debug.css Styleguide/Debug.css
$ "/Users/tobias/Sites/*********/node_modules/.bin/postcss"
Running it through npm-run-all manually does work as expected:
$ ./node_modules/.bin/npm-run-all css:*
> *********@0.0.0 css:production /Users/tobias/Sites/*********
> postcss -o Public/assets/default.css Styleguide/Default.css
> *********@0.0.0 css:debug /Users/tobias/Sites/*********
> postcss -o Public/assets/debug.css Styleguide/Debug.css
Version information:
Node: 7.6.0
Yarn: v0.21.3
Operating System: Mac OS 10.12.3
not sure if related but....
"css": "echo ok"
yarn run css
yarn run v0.20.3
$ echo ok
ok
$ "/Volumes/Repos/oc-ui-web/node_modules/.bin/postcss"
✖ Input Error: Did not receive any STDIN
error Command failed with exit code 1.
I can put anything in my css entry, it's correctly executed but there is this error at the end
I have the same issue. "yarn run css" fails while "npm run css" is successful.
Can anyone produce a package.json which allows me to repro this thing 100%?
@bestander To reproduce the Input Error: Did not receive any STDIN you can use this one:
{
"dependencies": {
"postcss-cli": "^4.0.0"
},
"scripts": {
"css": "echo ok"
}
}
Just run yarn run css and you should see this output:
$ yarn run css
yarn run v0.21.3
$ echo ok
ok
$ "/Users/tobias/Sites/foo/node_modules/.bin/postcss"
✖ Input Error: Did not receive any STDIN
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
My initial issue about the task not getting finished was solved by an update of postcss-cli.
Thanks.
The problem is here https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/run.js#L66.
When you do yarn run css, Yarn tries to run commands precss, css and postcss and postcss is a dependency with a binary.
Not sure actually how to properly solve it, any ideas?
I think the easiest solution would be to check which pre/post scripts are defined inside the package.json and only run them if they exist.
Would you send a PR?
I cannot promise anything and it might take a while but: yes. I'll look into it. :)
So, the user's quick fix to this is to rename the script from css to something else, say build-css. :-/
This should be fixed on latest nightlies. Wanna give them a shot?
Going to close this issue, let me know if it needs to be reopened
Most helpful comment
@bestander To reproduce the
Input Error: Did not receive any STDINyou can use this one:Just run
yarn run cssand you should see this output:My initial issue about the task not getting finished was solved by an update of
postcss-cli.