Skip to content

~/.npm and ~/tmp permissions for non sudo installs (e.g.: virtualenv) #24

Closed
@yuvilio

Description

@yuvilio

I ran into permission issues when trying to install this using virtualenv but found out what it was.

I got this error

OSError: Command ". nenv1/bin/activate...h && deactivate_node" failed with error code 3

When I ran it with --verbose, it turned out that it failed to write to my ~/.npm directory and ~/tmp directories. both were owned by root. for example the expanded error for the latter was:

..
npm ERR! addLocal Could not install .
npm ERR! Error: EACCES, mkdir '/home/yuvilio/tmp/npm-9739'
npm ERR! { [Error: EACCES, mkdir '/home/yuvilio/tmp/npm-9739'] errno: 3, code: 'EACCES', path: '/home/yuvilio/
tmp/npm-9739' }

..

I think this was because I had a node install from Ubuntu and ran sudo npm install which made those directories not accessible. When I switched to virtualenv and ran nodeenv, the npm install was blocked.

The fix was to make ~/.npm and ~/tmp writable. I went recursive (-R) for extra assurance:

sudo chown -fR myusername:myusername ~/.npm ~/tmp

The install then went through. Might be worth noting in the documentation somewhere.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions