从 Artifactory 安装作用域 npm 包 [英] Installing scoped npm packages from Artifactory
问题描述
我正在尝试让范围内的 npm 包与 Apache 背后的 Artifactory 一起使用.我可以将范围包发布到 Artifactory,它会在 npm-local 存储库中创建以下路径:@scopename/packagename/-/@scopename/packagename-version.tgz
尝试安装此软件包时出现问题.我得到一个 404 Not Found: @scopename/packagename
.查看调试日志我可以看到它可能与斜杠的编码有关:
22 http 请求 GET https://artifacts.company.com/artifactory/api/npm/npm-local/@scopename%2fpackagename23 http 404 https://artifacts.company.com/artifactory/api/npm/npm-local/@scopename%2fpackagename
我已按照在线文档进行操作.我将 AllowEncodedSlashes NoDecode
添加到虚拟主机,并将 org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
添加到 tomcat 上的 catalina.properties 文件.
我错过了什么吗?
这看起来像是一个反向代理问题.检查您的 request.log.如果请求是作为/api/npm/npm-group/@angular/core 而不是/api/npm/npm-group/@angular%2Fcore,那么这就是需要在您的反向代理中解决的问题.>
你必须改变两件事:实现设置 org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH = true并从/etc/nginx/conf.d/default.conf
中的 proxy_pass 变量中删除上下文根I am trying to get scoped npm packages to work with Artifactory behind Apache. I can publish a scoped package to Artifactory and it creates the following path in the npm-local repo: @scopename/packagename/-/@scopename/packagename-version.tgz
My problems arise trying to install this package. I get a 404 Not Found: @scopename/packagename
. Looking at the debug log I can see that maybe it has something to do with the encoding of the slashes:
22 http request GET https://artifacts.company.com/artifactory/api/npm/npm-local/@scopename%2fpackagename
23 http 404 https://artifacts.company.com/artifactory/api/npm/npm-local/@scopename%2fpackagename
I have followed the online documentation. I added AllowEncodedSlashes NoDecode
to the virtual host and org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
to the catalina.properties file on tomcat.
Am I missing something?
This looks like a reverse proxy issue. Check your request.log. If the request is coming is as /api/npm/npm-group/@angular/core instead of /api/npm/npm-group/@angular%2Fcore, that is something that need to addressed in your reverse proxy.
You have to change two things: implement the setting org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH = true and remove of the context root from the proxy_pass variable in /etc/nginx/conf.d/default.conf
这篇关于从 Artifactory 安装作用域 npm 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!