Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to always get newest version when using * instead of version number in package.json? [duplicate]

I have a private dependency on package.json and it should always install the latest version. So instead of the version, it's *.

"dependencies": {
   "@user/package": "*"
}

After the package was updated in npmjs it still installed old version with npm i if I enter exact version number instead of * - it installs a fresh version, which was published like a day ago.

I had a similar issue when the version was updated a minute ago at npmjs but now npmjs cache should be expired & updated with the new version, isn't it?

How can I avoid such issue and always get newest versions for everything with *?

I've tried npm cache verify npm cache clean --force. No luck.

like image 986
Lukas Liesis Avatar asked Nov 20 '17 12:11

Lukas Liesis


1 Answers

you can try to install with the packagename@latest keyword, but as far as i know you can only use this keyword in command line interface with npm install --save.

npm install --save mypackage@latest

after reading the doc here https://docs.npmjs.com/files/package.json i found you can write "latest" instead of any version number in a package.json file. This should do the trick.

like image 90
Ty Kayn Avatar answered Oct 19 '22 04:10

Ty Kayn