我了解 npm 脚本会添加./node_modules/.bin
到PATH
您npm test
的package.json
../node_modules/.bin
"scripts": {
"test": "mocha"
}
这是一个不错的功能,因为它可以节省我编写package.json
这样的文件:
"scripts": {
"test": "./node_modules/.bin/mocha"
}
但是,如果我引入一个在全球范围内安装 mocha 的新开发人员怎么办?或者我需要将其推送到具有预配置全局包的环境?如果我使用的是简写mocha
,而不是./node_modules/.bin/mocha
在 mypackage.json
中,那么全局或本地包的优先级是什么?