Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js bash: /usr/local/bin/node: Permission denied

I'm installing Node.js on Ubuntu machine. I followed official instructions:

./configure && make && sudo make install

So, I got node binary in /usr/local/bin/node and all dependencies. But when I run it from command line I get permission error:

> node
bash: /usr/local/bin/node: Permission denied

How can I fix it? How can I run it under my account? sudo node doesn't work too.

like image 463
demi Avatar asked Dec 13 '13 18:12

demi


People also ask

What might be causing the error error Eacces Permission denied access '/ usr local lib Node_modules '?

This means you do not have permission to write to the directories npm uses to store global packages and commands. Try running commands: sudo chmod u+x -R 775 ~/. npm and sudo chown $USER -R ~/. npm or you can just run any npm command with sudo , that should get resolve your issue.


2 Answers

You need read- and executable permissions for others. Issue:

sudo chmod +rx $(which node)

or

sudo chmod 755 $(which node)

However, normally make install should set that permissions. Looks like something in the Makefile is wrong.

like image 113
hek2mgl Avatar answered Oct 24 '22 14:10

hek2mgl


For people with no knowledge of osx terminal, open it and use these commands:

su yourusername
su chmod 755 /usr/local/bin/node
sudo node install...

This will make the folder readable/writeable and the sudo before the node command will make it run under admin rights.

like image 39
Renato Probst Avatar answered Oct 24 '22 14:10

Renato Probst