I am working on a usecase where there is a requirement to publish multiple versions of same package.
I have to publish these version of package in to my gitlab npm registry. I have searched on this but everyone is telling to use scopes which is not possible in my requirement. Is there a way that i can publish both these versions to my gitlab registry?
when i try to publish first version its publishing fine but for second version its giving me an error -
Unfortunately, you are forced to use scopes in the GitLab npm registry. See the documentation: Link
So the issue you are facing is not about the multiple Versions (that should work) but that you are not providing any scope.
On a side note: It seems like you are trying to proxy the actual entities
package, while you try to use some private packages? You don't need to do so and I would recommend against that. Some solutions:
Alialising is the life saver if you want to publish multiple versions of same package in gitlab, especially if you are trying to publish unscoped packages.
#!/bin/sh
list=$(npm ll --json | jq -r 'recurse(.dependencies[]) | [.name+"@"+.version] |@csv' | sed 's/"//g'| sort -u)
for i in $list; do
version_num=$(echo $i | rev | awk -F'@' '{print $1}' | tr '\.' '.'| rev);
name=$(echo $i | perl -pne 's/@[0-9]+(\.[0-9]+)+$//');
npm install $name-$version_num@npm:$i;
done
dirs=$(ls node_modules | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for i in $dirs; do
echo $i
npm publish node_modules/$i --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
atdirs=$(ls node_modules | grep "@")
for k in $atdirs; do
indirs=$(ls node_modules/$k | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for j in $indirs;do
echo $k/$j
npm publish node_modules/$k/$j --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.