npm 脚本与直接命令相比如何工作?
How to do npm scripts work vs direct commands?
我一直看到这种行为,所以我想了解它。我安装 gulp 和 gulp-cli(不是全局的)。输入 gulp 命令会得到 -bash: gulp: command not found
我使用 gulp 命令并将其放入 npm 脚本中,结果成功了。谁能解释一下这是怎么回事?
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp", // This works!!
"gulp-build": "gulp build" // As does this!!
},
嗯,有道理。我在项目中寻找 gulp 的相对路径找不到正确的路径。确实 ./node_modules/.bin/gulp 确实有效。并感谢 RobC 在文档中引用了这句话。现在完全有道理了!
我一直看到这种行为,所以我想了解它。我安装 gulp 和 gulp-cli(不是全局的)。输入 gulp 命令会得到 -bash: gulp: command not found
我使用 gulp 命令并将其放入 npm 脚本中,结果成功了。谁能解释一下这是怎么回事?
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp", // This works!!
"gulp-build": "gulp build" // As does this!!
},
嗯,有道理。我在项目中寻找 gulp 的相对路径找不到正确的路径。确实 ./node_modules/.bin/gulp 确实有效。并感谢 RobC 在文档中引用了这句话。现在完全有道理了!