-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing as non-root user does not work (access denied) #305
Comments
erratum: I actually use Also: when I run as root (leaving out the user param) it does work, but then I have to chown the entire node_modules dir with the |
@jblom Is this still an issue with the latest version of this module/Puppet/Ruby? |
Hi, thanks for replying let me check this later today. |
after upgrading the module to 3.1.0, the problem still persists. Later I can try upgrading Puppet/Ruby |
btw: I have Puppet 4.10.4 on RHEL 7.3 (Maipo) (this is the production server. So it does not work in the Centos container as well as on a VM with RHEL 7.3) Any idea what could be wrong? |
+1 |
@fnoop wow super thanks! This works now (the user in combination with the home_dir param): #This finally works (installing to the service user instead of root) nodejs::npm { "install ${service_name} npm packages as user ${service_user}":
ensure => 'present',
user => $service_user,
source => "/home/${service_user}/${service_name}/src/static",
target => "/home/${service_user}/${service_name}/src/static",
use_package_json => true,
home_dir => '~/.npm',
subscribe => File["/home/${service_user}/${service_name}/src/static/package.json"],
} |
Great! Be careful using ~ in home_dir, you might find that you've actually got |
@fnoop thanks again, you're right. I've changed it to: home_dir => "/home/${service_user}/.npm", which avoids that possibility. Now I can actually find the |
@juniorsysadmin at the very least the docs should include that: if you use: user => 'yourownuser' you need to include home_dir => /home/yourownuser/.npm Code wise you could hardwire that if the user param is used for a non-root user, by default the home_dir is set properly. What do you guys think? |
@jblom Could you submit a pull request for the README update? That will certainly help others in the future avoid having to figure this out again. |
@ghoneycutt sure I'll try to do this later today |
@jblom Bump |
I'm trying to manage node-sass with this module, and a home_dir parameter would make this a little smoother. This particular package just CANT be installed as root, at least in ubuntu. The permissions break down. |
Looks like this readme never did get updated and people are still having this issue. |
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
The process is trying to access
/root/.npm
while it is running as a different user:e.g. part of the log:
npm ERR! { Error: EACCES: permission denied, mkdir '/root/.npm'
What behaviour did you expect instead
I expected that the process was not trying to use anything inside the root dir. When I run npm install in the source directory as that
$service_user
it works.Output log
The text was updated successfully, but these errors were encountered: