Bob
Bob

Reputation: 783

npm installs wrong package version

I'm trying to install karma using the following command npm i karma@^1.0.0. npm installs [email protected] rather than latest version [email protected]. After a little investigation, I figured out that these commands work: npm i karma@^1 and npm i karma@^"1.0.0" (enclose command with double quotes). Anyone can explain how it should work?

I guess that this is not related to karma since it's reproducible with any package.

npm - 4.0.5, node - 7.4.0

Thanks.

Upvotes: 0

Views: 1016

Answers (1)

raina77ow
raina77ow

Reputation: 106365

It's mentioned in the docs:

Note that most version ranges must be put in quotes so that your shell will treat it as a single argument.

And the example given there follows the advice:

npm install sax@">=0.1.0 <0.2.0"

Upvotes: 1

Related Questions