2016-12-06 23 views
1

私はArtifactory Pro 4.12.1を使用しています。 npmjs-localと呼ばれるローカルのnpmリポジトリ、リモートのnpmリポジトリnpmjs-remote、および仮想のnpmリポジトリnpmjsを作成して、前の2つのreposを集約しました。Artifactory: 'npmjs'にnpmリポジトリインデックスが見つかりません

$ 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 

私が走った

は、次に私が使用して、レジストリとしてArtifactoryを使用するようにNPMを設定し同じ検索で--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' 

このエラーの原因は何ですか?

+0

:あなたは、次のようなメッセージが表示されるはず? Artifactoryの前にHTTPプロキシがありますか? –

答えて

2

これは、仮想リポジトリのNPMインデックスが生成されなかった場合に発生します。

curl -uadmin:password -XPOST http://artifactory.example.org:8081/artifactory/api/npm/npmjs/reindex 

REST呼び出しがArtifactoryログを使用してモニターすることができる非同期インデックス作成プロセスをトリガーします:問題を解決するために

最高のリポジトリのインデックスを再作成することで、これはREST APIを使用して行うことができますファイル。 http://artifactory.example.org/artifactory/api/npm/npmjs/-/allするGETリクエストを送信するときに、あなたが取得している応答である何

2016-12-07 13:11:02,455 [http-nio-8081-exec-5] [INFO ] (o.a.a.n.r.NpmRequestHelper:124) - Recalculating index for npm repository npmjs scheduled to run 
2016-12-07 13:12:02,527 [art-exec-102209] [INFO ] (o.a.a.n.NpmServiceImpl:237) - Npm metadata recalculation has been started for repository 'npmjs' 
2016-12-07 13:13:31,071 [art-exec-102209] [INFO ] (o.a.a.n.NpmServiceImpl:263) - Finished npm metadata recalculation for repo 'npmjs' in 1.48 minutes 
+0

リポジトリのインデックスを再作成しても問題は解決しません。 –

+0

再インデックスが正常に完了したことを確認しましたか?ログファイルに関連するエラーが表示されますか? –

関連する問題