Search code examples
npmnpm-installazure-artifacts

npm not installing latest version of my package


I have created my own npm feed in Azure Artifacts. I can publish my package and use it in my applications.

In my applications, the package is referenced like this in the package.json

`"@op/breeze-helpers": "^0.1.5"`

If I now publish version 0.1.6 of my package, delete my package from node_modules and run npm i , npm installs version 0.1.5 again !

I even tried npm i --cache c:/tmp/empty-cache to make sure it was not getting the package from cache, but it ends up the same. npm keeps installing version 0.1.5

what am doing wrong, I thought with the caret, the next minor should be downloaded when running npm i ?


Solution

  • The package-lock.json sets your currently installed version of each package in stone, and npm will use those exact versions when running npm install.

    So it will download the package versions from the package-lock.json file.

    I want to be on latest version always.

    You could try to set the "*" as the dependency package version.

    For example:

    "dependencies": {
        "@types/bootstrap": "*",
        "@types/jquery": "*",
        "bootstrap": "*"
    
      }
    

    Then it will always download the latest version of the target packages.