从Artifactory安装作用域npm软件包 [英] Installing scoped npm packages from Artifactory

查看:223
本文介绍了从Artifactory安装作用域npm软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使范围限定的npm软件包与Apache背后的Artifactory一起使用.我可以将范围限定的包发布到Artifactory,它会在npm-local仓库中创建以下路径:@scopename/packagename/-/@scopename/packagename-version.tgz

尝试安装此软件包时出现了我的问题.我得到一个404 Not Found: @scopename/packagename.查看调试日志,我可以发现它可能与斜杠的编码有关:

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

我已遵循在线文档.我将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆