Is it possible to install npm package only if it has not been already installed?

后端 未结 5 1725
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 19:03

Is it possible to install npm package only if it has not been already installed?

I need this to speed up test on CircleCI, but when I run npm inst

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 19:55

    You could try npm list protractor || npm install protractor@2.1.0

    Where npm list protractor is used to find protractor package.

    If the package is not found, it will return npm ERR! code 1 and do npm install protractor@2.1.0 for installation

提交回复
热议问题