我正在使用Artifactory Pro 4.12.1。我創建了一個稱爲npmjs-local
的本地npm存儲庫,一個名爲npmjs-remote
的遠程npm存儲庫和一個名爲npmjs
的虛擬npm存儲庫,用於彙總前兩個回購站。Artifactory:在'npmjs'找不到npm存儲庫索引
然後我配置NPM使用Artifactory的註冊表,使用:
$ npm config set registry http://artifactory.example.org/artifactory/api/npm/npmjs
當我嘗試搜索使用npm search foo
一個包,我得到以下錯誤:
npm WARN Building the local index for the first time, please be patient
npm ERR! registry error parsing json
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.2.0/bin/node" "/usr/local/bin/npm" "search" "foo"
npm ERR! node v7.2.0
npm ERR! npm v3.10.9
npm ERR! Unexpected token C in JSON at position 0
npm ERR! Cannot find the npm repository index at 'npmjs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dserodio/npm-debug.log
我跑同樣的搜索使用--loglevel verbose
,我看到的是「無效的JSON」是從http://artifactory.example.org/artifactory/api/npm/npmjs/-/all來:
Cannot find the npm repository index at 'npmjs'
編輯:這通過Nginx代理並直接發送到Artifactory。這是一個完整的HTTP響應:
$ curl -v http://artifactory.example.org:8081/artifactory/api/npm/npmjs/-/all
* Trying 10.1.2.3...
* Connected to artifactory.example.org (10.1.2.3) port 8081 (#0)
> GET /artifactory/api/npm/npmjs/-/all HTTP/1.1
> Host: artifactory.example.org:8081
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: Artifactory/4.12.1
< X-Artifactory-Id: b0f4dd7e3f5106cd:-3efe7253:158c0a36030:-7ffd
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Tue, 06 Dec 2016 16:35:01 GMT
<
* Connection #0 to host artifactory.example.org left intact
Cannot find the npm repository index at 'npmjs'
什麼導致這個錯誤?
什麼是發送一個GET請求來http://artifactory.example.org/artifactory/api/npm/npmjs/-/all時,你所得到的迴應? Artifactory前面有一個HTTP代理嗎? –