npm - 无法使用 npm api 将 npm 包上传到 GitLab
问题描述
由于自托管 gitlab 服务器中的离线要求,尝试将 npm 包(本地计算机的依赖项)上传到 GitLab 包注册表。
https://docs.gitlab.com/ee/api/packages/npm.html#upload-a-package-file
curl -v -k --request PUT ^
--data "@<full-path>/node_modules/array-unique/package.json" ^
--data "versions=0.2.1" ^
--header "Content-Type: application/json" ^
--header "Authorization: Bearer <personal-access-token>" ^
"https://gitlab.example.com/api/v4/projects/2/packages/npm/array-unique"
这就是回应
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 400 Bad Request
< Server: nginx
< Date: Thu, 09 Sep 2021 12:35:55 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Connection: keep-alive
< X-Request-Id: 01FF58XDK0NSJ77D6R9VJ8Z2RY
< X-Runtime: 0.003207
它似乎能够建立连接并发送文件数据,但它返回错误 400。这里有什么问题?
解决方案
推荐阅读
- sql - 联合嵌套选择中的排序依据
- configuration - 配置 SonarQube (Node.JS) 以从内部服务器下载二进制文件
- powershell - Powershell 按值传递复杂对象,而不是按引用
- elixir - Elixir - 动态设置 stripity_stripe 库的请求标头
- ios - 在自定义对象类型的核心数据中保存带有子项的类别
- reactjs - 无法使用 Formik 设置“isSubmitting”
- docker - 使用 Karate-Chrome 运行测试(连接被拒绝异常)
- java - Java Stream#map 显然不再工作了
- r - 如何在R中的给定位置生成给定变量字符的所有可能字符串?
- scala - 凿子中的 != 和 =/= 有什么区别?