[英]How can NPM run a command that isn't in path
The ava
command is not in my path. ava
命令不在我的路径中。 I can not run it from in the project directory that contains some AVA tests. 我无法在包含某些AVA测试的项目目录中运行它。
My npm test
command of my project is set to ava tests/*.js --verbose
, and can somehow call the ava
command from the same location in the terminal. 我将项目的
npm test
命令设置为ava tests/*.js --verbose
,并且可以通过某种方式从终端的同一位置调用ava
命令。
My questions is: how is npm calling the ava
command? 我的问题是:npm如何调用
ava
命令? I suspect it is calling it from the project's node_modules
folder, but I could not find it in any source. 我怀疑它是从项目的
node_modules
文件夹中调用它的,但是在任何源中都找不到它。
If anyone can explain how this happens, or better yet show me the source, I would really appreciate it. 如果有人可以解释这种情况是如何发生的,或者更好地向我展示消息来源,我将不胜感激。
当您运行npm run [script]
或本例中的npm test
,NPM非常聪明,可以尝试首先从node_modules/.bin
目录执行二进制文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.