"VAR=value command param" working on Unix but not on Windows in package.json #5738

Closed
bcomnes opened this Issue Jul 21, 2014 · 5 comments

Comments

Projects
None yet
3 participants

bcomnes commented Jul 21, 2014

On *nix systems, I can add something like this to my module's package.json:

{
"scripts": {
    "dev": "DEBUG=routes:* ENV=development node ./bin/www"
  }
}

which sets up some simple ENV vars for me to use with some popular modules like debug.

This does not work on windows however, even though you can totally run:

DEBUG=routes:* ENV=development node ./bin/www

from git bash or whatever.
Maybe this is totally an anitpattern, but it seems like this should work on windows too.

@othiym23: win-spawn is smart enough to deal with that, so npm should be able to as well

bcomnes changed the title from VAR=value command param" working on Unix but not on Windows in package.json to "VAR=value command param" working on Unix but not on Windows in package.json Jul 21, 2014

othiym23 added the windows label Jul 21, 2014

Contributor

othiym23 commented Jul 21, 2014

npm should either just use win-spawn for this or copy its pattern for parsing out the command line. This seems like a completely reasonable thing for which to have platform parity.

bcomnes commented Jul 26, 2014

It just occurred to me that win-spawn can actually be used today to fix this issue by just prefixing npm scripts that will be run on windows with it. Still, it would be nice to have parity.

Contributor

sheerun commented Dec 8, 2015

But win-spawn won't work on non-windows: https://github.com/ForbesLindesay/win-spawn/issues/13

Contributor

sheerun commented Dec 9, 2015

There's: http://npm.im/cross-env

bcomnes commented Dec 20, 2016

Works for me.

bcomnes closed this Dec 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment