Alexander Gorelik
Alexander Gorelik

Reputation: 4385

Npm does not install packages

I Have strange behavior on my npm

This a little part of my package.json

  "devDependencies": {
    ....
    "css-loader": "^0.23.1",
    "del": "^2.2.1",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-clean-css": "^2.0.10",
    "gulp-concat": "^2.6.0",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^0.5.4",
     ....
   }

When i run npm i everything is installed.

Immediate afterward i hit npm i [email protected].
The same package that was installed but the strange things that i get more packages installed when i expect to receive that everything is up to date.

Any idea why npm behave so?

Without the specific npm i [email protected] i get my build broken and got fixed after the specific install.

Upvotes: 0

Views: 54

Answers (1)

Steve Land
Steve Land

Reputation: 4862

Thats because you're specifying your package versions in your package.json using the ^ character, which only restricts the MAJOR version number (the first number in x.x.x). See https://github.com/npm/node-semver#caret-ranges-123-025-004

When you are running your specific package installation command you're specifying a specific version strictly (without ^) meaning that it will fetch that package version exactly.

Upvotes: 1

Related Questions