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

后端 未结 5 1715
爱一瞬间的悲伤
爱一瞬间的悲伤 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:57

    with bash you can do

    [ $(node -p "require('protractor/package.json').version") != "2.1.0" ] && npm install protractor@2.1.0
    

提交回复
热议问题