npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1000 "/root/.npm"
We are using private registry to publish the library. And this error is getting when CD pipeline runs at the time of deployment.
Below stages are running while CD deployment -
Clone
Install
lint
Code quality
Pack
Build
Build Image
Scan Image
Publish
I cannot share the codebase or working example.
I can share package.json screenshot-
I tried below options along with npm publish script but no luck-
npm cache clean -f
sudo chown -R 1000:1000 "/root/.npm"
Please help me with this issue