npm脚本与直接命令如何做?

问题描述 投票:0回答:1

我一直看到这种行为,所以我想了解一下。我安装了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!!
  },
npm gulp npm-scripts
1个回答
0
投票

啊,这就明白了。我在项目中寻找gulp的相对路径,但找不到正确的路径。事实上.node_modules.bingulp确实能用。谢谢你RobC引用文档中的那句话。现在完全明白了

© www.soinside.com 2019 - 2024. All rights reserved.