Node.js bash: /usr/local/bin/node: Permission denied
36,444
Solution 1
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.
Solution 2
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.
Author by
demi
I work for Google, love functional programming and Clojure, but code in C++, Java and JS.
Updated on July 13, 2022Comments
-
demi almost 2 years
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. -
hek2mgl over 10 yearsThx :) The whole GNU userland is fantastic! Can't stop loving it :)
-
demi over 10 yearsI have
node
executable for the user (see comment under answer aboutls -l
). For me,chown
worked (it wasroot root
as you can see).chmod
didn't help. -
hek2mgl over 10 yearsBinaries (or scripts) located in
/usr/local/bin
are expected to be owned by root, group root and having permissions set to755
. That's standard. I'm not sure what you are doing there. -
hek2mgl over 10 yearsAlso I expect that
make install
will install to/usr/bin
and not/usr/local/bin
. Maybe you have an old node binary residing in/usr/local/bin
which get's executed (or makes trouble) instead of the previously installed binary by make install (to/usr/bin
) ? -
Ar5hv1r almost 9 yearsI ran into this error after having run
+x
, turned outothers
didn't have read access and it needs both. So755
(or+xr
) might be necessary if+x
is insufficient. -
hek2mgl almost 9 years@dimo414 Thanks. I've edited that. When posting the answer I assumed read permissions had been granted already.
-
JRichardsz almost 8 yearsIn my case I knew node binarie path, so : sudo chmod +rx /apps/.../node-v4.2.3-linux-x64/bin/node works!! THanks hek2mgl
-
JD Smith about 4 yearsWorked for me with my custom node install in SAP Hybris. Thank you!
-
JD Smith about 4 yearsFYI "su chmod..." didn't work for me in my Mac - I had to do "sudo chmod..."