mkdir: cannot create directory ‘/usr/local/n/versions’: Permission denied

14,033

Are you logged in as root user on your ubuntu machine? If not, try running the commands with sudo.

You also may have to chown the /usr/local/n directory to your user.

It's often one of these that cause the permission denied error you're seeing.

Share:
14,033
cnio
Author by

cnio

Updated on June 04, 2022

Comments

  • cnio
    cnio almost 2 years

    When I run npm install n -g on my computer (Ubuntu), I have these errors:

    ➜  ~  npm install -g n
    
    /home/joes/.nvm/v0.10.38/bin/n ->          /home/joes/.nvm/v0.10.38/lib/node_modules/n/bin/n
    [email protected] /home/joes/.nvm/v0.10.38/lib/node_modules/n`
    
    ➜  ~  n
    
    mkdir: cannot create directory ‘/usr/local/n/versions ’: Permission denied
    mkdir: cannot create directory ‘/usr/local/n/versions ’: Permission denied
    find: '/usr/local/n/versions': No such file or directory`
    Error: no installed version