node.jsnpmnpm-install

What is the purpose of using --save-exact


Want to know the use of -exact with --save

npm i typescript@3.4 --save-dev --save-exact

Solution

  • --save-exact makes sure that no sliding versions (with ~ or ^ ) will be installed.

    "devDependencies": {
        "webpack": "5.1.3",
    }
    

    instead of potentially

    "devDependencies": {
        "webpack": "^5.1.3",
    }
    

    Docs

    Article by TeamTreeHouse on --save-exact https://teamtreehouse.com/community/why-install-npm-packages-as-saveexact

    NPM Docs for install https://docs.npmjs.com/cli/install

    Tilde(~) vs Caret(^) in package.json What's the difference between tilde(~) and caret(^) in package.json?