简体   繁体   中英

package.json script to install global module if missing and then use it

I want an npm script that will:

  • Check to see if a global module is installed
  • If not, install it
  • Use it

There will be a scripts entry in my package.json to do this.

"scripts": {
    "exeglobal": "TODO: check to see if global package is installed, if not install it, then use it"
}

Anyone know an OS independent way of doing this?

您可以将模块添加到devDependency并像这样使用它。

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