简体   繁体   中英

npm installs wrong package version

I'm trying to install karma using the following command npm i karma@^1.0.0 . npm installs karma@1.0.0 rather than latest version karma@1.6.0 . 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.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM