简体   繁体   中英

Running package.json dependencies when dependencies are not global

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?"

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM