如何使包pipe理器npm在Mac OS X上使用bash 4?

我使用自制软件在Mac OS X Yosemite上更新了bash版本 ,以便在我的npm脚本中使用“globstar”。 例如使用模式./test/**/*.jsrecursion地列出test目录中的所有.js文件。 但是,npm将运行较旧的bash版本(版本3)的脚本。

是否有可能使npm使用更新的bash版本?

(我不确定,但我想npm使用/ bin / bash而不是/ usr / local / bin / bash)

更新:我的具体用例是调查使用npm作为构build工具的可能性,例如,使用诸如"build:test:scripts": "browserify ./test/**/*.js -o /build/test-bundle.js",类的npm脚本将所有testing规范捆绑到"build:test:scripts": "browserify ./test/**/*.js -o /build/test-bundle.js",

只需将script-shell config键设置为Bash 4安装的path即可。

script-shell :用于脚本的shell使用npm run命令npm run

 # local npm config set script-shell "/usr/local/bin/bash" # global npm config set -g script-shell "/usr/local/bin/bash" 

尝试用单引号包装“globstar”:

 "build:test:scripts": "browserify './test/**/*.js' -o /build/test-bundle.js",