Node for non root users
-
I am trying to setup node for non root users but couldn't figure it out. Below are the commands I used till now
wget https://nodejs.org/dist/v5.6.0/node-v5.6.0.tar.gz
tar -xvzf node-v5.6.0.tar.gz
cd node-v5.6.0
./configure
make
make installAnd from few sites, found that to enable access to non root users, execute below commands:
ln -s /usr/local/bin/node /usr/bin/node
ln -s /usr/local/lib/node /usr/lib/node
ln -s /usr/local/bin/npm /usr/bin/npmStill when i switch back to a regular user, and try to run an npm command, gives me error:
Eg: npm i gulp -g
Gives me
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/gulp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── [email protected]npm ERR! Linux 3.10.0-327.4.4.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/bin/npm" "i" "gulp" "-g"
npm ERR! node v5.6.0
npm ERR! npm v3.6.0
npm ERR! path /usr/local/lib/node_modules/gulp
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall accessnpm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/gulp'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/gulp']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/gulp' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.npm ERR! Please include the following file with any support request:
npm ERR! /var/home/user/npm-debug.log -
Why are you installing Node from source and not via NVM?
-
I just tried with NVM, and installed gulp on root, but cant use the same on a non root user.
-
Some sites mention to change the ownership of /usr/local to that user, which for me doesnt makes sense. What if you need to install gulp for example to another user? Dont seem to be right to keep changing permission as and when required by new user account!
-
@Ambarishrh said:
I just tried with NVM, and installed gulp on root, but cant use the same on a non root user.
install NVM as root, run it as the user to set up the right version for them.
-
Installed nvm as root and when i try to run anything related to that as a regular user;
Eg: nvm ls-remote
bash: nvm: command not found