Following this tutorial
and trying to use the command
echo 'prefix=/usr/local' > node/etc/npmrc
however I get a permission denied error, even when using sudo.
Any ideas?
Following this tutorial
and trying to use the command
echo 'prefix=/usr/local' > node/etc/npmrc
however I get a permission denied error, even when using sudo.
Any ideas?
echo 'prefix=/usr/local' > node/etc/npmrc
however I get a permission denied error, even when using sudo.
You haven't shown us the failing command using sudo
. Please update your question and show us the exact command that failed, along with the exact error message.
Meanwhile, I can guess that the failing command was:
sudo echo 'prefix=/usr/local' > node/etc/npmrc
That runs the echo
command with root privileges (which is not particularly useful, since you can runecho
as an ordinary user). The redirection is handled by your current shell process, and is subject to the permissions of the current user.
Since >
is handled by the shell, you need a shell running as root
to handle it:
sudo sh -c "echo 'prefix=/usr/local' > node/etc/npmrc"