Running package.json dependencies when dependencies are not global

此生再无相见时 提交于 2019-12-11 07:12:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!