Introduction
When using the npm repository, after running the “pnpm install” commands, there will be a pnpm-lock.yaml file generated and including the following content:
resolution: {integrity: sha512-5zR*************9VWolmKlRysnjePc8C7r/Ot24WmcspDgebw==, tarball: http://172.16.60.163:80/artifactory/api/npm/test-npm/nltk/-/nltk-0.0.1.tgz}
The customer doesn’t want to show the Artifactory server URL in the tarball value.
Root Cause
The reason why resolution bodies include tarball fields is that the request download URL is different from the actual storage URL, which leads to show tarball fields .
The request download URL is the registry URL from the example .npmrc file below;
The .npmrc file is the configuration file when using npm/pnpm command and the content of this example .npmrc file is generated from Artifactory npm repository SetMeUp;
email=youremail@email.com
always-auth=true
registry=http://172.16.60.163/artifactory/api/npm/test-npm/
//172.16.60.163/artifactory/api/npm/test-npm/:_auth=<token>
Use curl command can check the tarball URL of target package;
curl –uadmin:password http://172.16.60.163/artifactory/api/npm/fan-npm-local/express
###
"dist" : {
"tarball" : "http://172.16.60.163:80/artifactory/api/npm/fan-npm-local/express/-/express-4.21.2.tgz",
####
}
####
Due to the registry URL is not equal with tarball URL, then the pnpm-lock.yaml will include tarball field;
cat pnpm-lock.yaml
###
resolution: {integrity: sha512-5zR84nCl53GN7qC9EGe69K+sU0ua15MG9Kb2DBc+UDWSYjhExY+9VWolmKlRysnjePc8C7r/Ot24WmcspDgebw==, tarball: http://172.16.60.163:80/artifactory/api/npm/test-npm/nltk/-/nltk-0.0.1.tgz}
###
Resolution
- Check .npmrc file;
- Update the registry url from .npmrc file to be the same with the actual server url from the tarball fields;
- Install npm packages by “npm install” and then it won’t generate tarball fields in the pnpm-lock.yaml file.