http://javascript.ruanyifeng.com/nodejs/packagejson.htmljavascript
好比下面的packagecss
{ "dependencies": { "babel-core": "^5.8.25", "babel-loader": "^5.3.2", "browserslist": "^1.0.1", "bundle-loader": "^0.5.4", "css-loader": "~0.16.0", "file-loader": "~0.8.4", "jquery": "~2.1.4", "jsx-loader": "~0.13.2", "num2fraction": "^1.2.2", "react": "~0.13.3", "react-hot-loader": "^1.2.8", "react-router": "^0.13.3", "style-loader": "~0.12.3", "url-loader": "~0.5.6", "webpack": "~1.11.0", "webpack-dev-server": "^1.10.1" }, "devDependencies": { "webpack": "^1.11.0" } }
須要注意的是,若是大版本號爲0,則插入號的行爲與波浪號相同,這是由於此時處於開發階段,即便是次要版本號變更,也可能帶來程序的不兼容。html
參考
http://stackoverflow.com/questions/22343224/difference-between-tilde-and-caret-in-package-jsonjava
version | desc |
---|---|
~version | "Approximately equivalent to version" See npm semver - Tilde Ranges & semver (7) |
^version | "Compatible with version" See npm semver - Caret Ranges & semver (7) |
version | Must match version exactly |
>version | Must be greater than version |
>=version | etc |
<version | etc |
* | Matches any version |