问题
Let's say I have a package.json with "rimraf" as a dependency in it. "rimraf" is not installed globally. What command, from the command prompt, can I enter to run "rimraf"? Something like "npm run-command rimraf?"
回答1:
You'd run
./node_modules/.bin/rimraf
or if it is some common task, I'd add it to your package.json
:
"scripts": {
"clean": "rimraf ..."
}
and then call npm run clean
. Commands in scripts
automatically resolve with ./node_modules/.bin
.
来源:https://stackoverflow.com/questions/28885110/running-package-json-dependencies-when-dependencies-are-not-global