When npm installs the package, if you specify the dependent version of the package to use ~ instead of ^?

A previous project was opened today. When I executed npm install, I found that

could not be installed.

then Baidu made a circle and said that the ^ in package.json could be installed. Then I tried it and found that it was really OK.

I would like to ask if I use ~ instead of ^ by default during installation?

Mar.02,2021

npm config set save-prefix'~'

but not just ~ ^
"express": "^ 4.16.3" means to install 4.x.x
"express": "~ 4.16.3" means to install 4.16.x
generally 4.x.x is compatible, of course, the implementation of this specification depends on this package . It's hard to say that package that doesn't conform to the previous specification will definitely conform to the latter specification.
if you are not sure, you can use npm install xx-E fixed version

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b309d4-2bd26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b309d4-2bd26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?