[英]Running package.json dependencies when dependencies are not global
Let's say I have a package.json with "rimraf" as a dependency in it. 假设我有一个package.json,其中有“ rimraf”作为依赖项。 "rimraf" is not installed globally.
全局未安装“ rimraf”。 What command, from the command prompt, can I enter to run "rimraf"?
我可以在命令提示符下输入什么命令来运行“ rimraf”? Something like "npm run-command rimraf?"
像“ npm运行命令rimraf?”之类的东西。
You'd run 你会跑
./node_modules/.bin/rimraf
or if it is some common task, I'd add it to your package.json
: 或者,如果这是一些常见的任务,则将其添加到您的
package.json
:
"scripts": {
"clean": "rimraf ..."
}
and then call npm run clean
. 然后调用
npm run clean
。 Commands in scripts
automatically resolve with ./node_modules/.bin
. scripts
命令使用./node_modules/.bin
自动解析。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.