Solution
sh
# make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share# take ownership of Node.js install destination folders
$(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
sudo chown -R
n
Using sh
# make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n$(whoami) /usr/local/n
sudo chown -R # make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share# take ownership of Node.js install destination folders
$(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
sudo chown -R
See: tj/n: Node version management - Installation
Linux File Ownership
- User:
cat /etc/passwd
- Group:
cat /etc/group
- List files user and group:
ls -l
- Change files user and group:
chown <newowner>:<newgroup> <file or directory>