Bail out gracefully when running inside Yarn?
lehni opened this issue · comments
Jürg Lehni commented
I am not sure if this is possible, but I had this problem here with http://paperjs.org/ where I am using npm-force-resolutions
to work around issues with Gulp 3 on recent Node versions:
But when installing paper
with yarn, this now fails in the preinstall step.
Since Yarn natively supports resolutions
, the current fix is to use if-env
to only run the command if npm is used, but maybe npm-force-resolutions
could do this internally?
"preinstall": "if-env npm_config_heading=npm && npx npm-force-resolutions"
Nathan Vogel commented
On Windows, if I use PowerShell (VSCode's default terminal) and try to install via yarn I get this:
error D:\dev\node_modules\paper: Command failed.
Exit code: 1
Command: [[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true
Arguments:
Directory: D:\dev\node_modules\paper
Output:
'[[' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.
Using git's terminal works :)