shelljs / shx

Portable Shell Commands for Node
MIT License
1.72k stars 44 forks source link

Fails trying to utilise the new script-shell npm config #117

Closed danielbayley closed 7 years ago

danielbayley commented 7 years ago

The release of npm 5.1.0 introduced the ability to set a different shell for running package.json scripts, so I thought a cool idea would be to do: npm config set script-shell node_modules/.bin/shx

But for some reason it doesn't work and I'm not sure why?

# .npmrc
script-shell = node_modules/.bin/shx
// package.json
"scripts": {
  "test": "echo something" // fails! :/
}
> npm test
Error: Missing ShellJS command name

shx: A wrapper for shelljs UNIX commands.

Usage: shx <command> [options]

Example:

    $ shx ls .
    foo.txt
    bar.txt
    baz.js
    $ shx rm -rf *.txt
    $ shx ls .
    baz.js

Commands:

    - cat
    - chmod
    - cp
    - echo
    - tempdir
    - pwd
    - ls
    - find
    - grep
    - head
    - ln
    - mkdir
    - rm
    - mv
    - sed
    - sort
    - tail
    - test
    - touch
    - uniq
    - which
    - error
    - help

npm ERR! Test failed.  See above for more details.

If this worked I could finally [almost] pretend Windows doesn't exist as far as npm scripts are concerned, without even having to prefix every script command with shx, yet still support those unfortunate users…

nfischer commented 7 years ago

I agree with @danielbayley's comment. dthree/cash is a better solution for this, so I'm closing this issue.