Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 package.json,其中有“rimraf”作为依赖项。“rimraf”未全局安装。我可以从命令提示符输入什么命令来运行“rimraf”?像“npm run-command rimraf”之类的东西?
你会跑
./node_modules/.bin/rimraf
或者,如果这是一些常见任务,我会将其添加到您的package.json:
package.json
"scripts": { "clean": "rimraf ..." }
然后调用npm run clean. 中的命令scripts自动解析为./node_modules/.bin.
npm run clean
scripts
./node_modules/.bin