npm run是npm CLI提供的一个命令,实例化一个shell并执行项目的package.json中提供的命令。
例如package.json中配置如下,
{
"name": "test-npm",
"script": {
"test": "node /build.js"
}
}
执行npm run test,npm会先检查package.json中是否在script字段中配置了test,并在终端执行test对应的命令node /build.js。