Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

node.js - Installing scoped npm packages from Artifactory

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...