如果我使用下面给出的new Getproduct().execute();
来执行 extension URL {
func appendingNonEscapedQueryItems(_ queryItems: [URLQueryItem]) -> URL {
let url = self
var urlString = url.absoluteString
for queryItem in queryItems {
let queryName = queryItem.name
guard let queryValue = queryItem.value else {
continue
}
let query = queryName + "=" + queryValue
if queryItem == queryItems.first {
urlString = urlString + "?" + query
}
else
{
urlString = urlString + "&" + query
}
}
return URL(string: urlString)!
}
}
...
let requestURL = components.url!.appendingNonEscapedQueryItems(queryItems)
print("URL \(requestURL)")
,那么即使我指定了版本package.json
,也会安装npm install
(请参阅下面的react-15.4.2
)。
这怎么可能?
为什么会这样?
我该如何避免这种情况?
npm ls
的内容:
15.3.2
package.json
给出:
{
"name": "sbt-demo",
"version": "0.1.0",
"description": "Webpack configuration for sbt-demo",
"license": "GPL-3.0",
"scripts": {
"build": "webpack --config webpack.config.prod.js",
"dist": "webpack --config webpack.config.prod.js"
},
"devDependencies": {
"compression-webpack-plugin": "^0.2.0",
"css-loader": "^0.23.0",
"file-loader": "^0.8.4",
"ghooks": "^1.3.2",
"gulp-decompress": "^1.1.0",
"image-webpack-loader": "^1.6.1",
"imagemin": "^4.0.0",
"lodash": "^4.14.1",
"node-libs-browser": "^0.5.2",
"react-hot-loader": "^1.2.7",
"style-loader": "^0.13.0",
"url-loader": "^0.5.6",
"webpack": "^1.9.10",
"webpack-dev-server": "^1.9.0"
},
"dependencies": {
"highlight.js": "8.9.1",
"material-ui": "^0.15.2",
"react": "^15.3.2",
"react-addons-create-fragment": "15.3.2",
"react-addons-css-transition-group": "15.3.2",
"react-addons-pure-render-mixin": "15.3.2",
"react-addons-transition-group": "15.3.2",
"react-addons-update": "15.3.2",
"react-dom": "^15.3.2",
"react-geomicons": "^2.0.4",
"react-grid-layout": "^0.13.9",
"react-infinite": "^0.7.1",
"react-select": "^1.0.0-beta",
"react-sortable-hoc": "^0.2.0",
"react-spinner": "^0.2.3",
"react-tagsinput": "^3.0.3",
"react-tap-event-plugin": "^1.0.0",
"svg-loader": "0.0.2"
}
}
答案 0 :(得分:4)
因为你给了"反应"插入符号"react": "^15.3.2"
它将始终获取小于16.0.0的最新版本。
要获得确切的反应版本,请在版本"react": "15.3.2"
之前删除插入符。
但是,通过这样做,您必须手动检查/更改使用react的其他依赖项的版本依赖性。因为它们可能与您指定的反应版本不兼容。
有关官方文档,请参阅https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004。