Make `npm install --save` add a strict version to package.json

前端 未结 3 1485
走了就别回头了
走了就别回头了 2021-01-30 05:06

When you run npm install --save somepackage, it usually adds something like this into package.json:

\"dependencies\": {
    \"somepackage\": \"^2.1.         


        
3条回答
  •  一个人的身影
    2021-01-30 05:42

    You can change the default behaviour by using the --save-exact option.

    // npm
    npm install --save --save-exact react
    
    // yarn
    yarn add --exact react
    

    I created a blog post about this if anyone is looking for this in the future.

    https://www.dalejefferson.com/blog/how-to-save-exact-npm-package-versions/

提交回复
热议问题