Is this really such an uncommon situation that I can't find answers anywhere? Anyway. I have a Ubuntu VM server on DigitalOcean and I am running Jenkins on this server to do build, test and local deploy of a web app (essentially copy the web app directory to other location and restart the systemctl service that runs it).
Issue is that the user that jenkins generates in the system (with which you can't login btw), has somehow messed up node modules directory. It is installed in the jenkins home folder /var/lib/jenkins/
, when performing npm install
(despite there being no -g
option), instead of build deploy directory and package resolution from within the application can not resolve modules installed in jenkins home (despite being run by jenkins, so by jenkins user).
I suspect that the solution would be to allow somehow managed installation of node, such that every user can install and require global modules without the need to use sudo
, but so far every solution I looked up (nvm, n-install, various scripts) are for single user, or sudo. I can not really do anything to the jenkins (or any other program-generated) user. So what's the best solution in this case?