nodejs is getting installed but not accessible from home or other location
Closed this issue · 6 comments
Cookbook version
version '3.0.1'
Chef-client version
12.11
Platform Details
AWS EC2 instances
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Scenario:
I am simply installing nodejs using cookbook from a custom location. node js is getting installed on /usr/local/nodejs-binary-7.9.0/bin/ but it is not loaded as a environment varriable. i am able to access nodejs after going through above location but not from home directory or any other location.
Steps to Reproduce:
- Install cookbook from custom location
- set following value in attributes/default.rb
default['nodejs']['install_method'] = 'binary'
default['nodejs']['version'] = '7.9.0'
default['nodejs']['binary']['url'] = 'https://s3-xxxxxamazonaws.com/xxxx/node-v7.9.0-linux-x64.tar.xz'
default['nodejs']['binary']['checksum'] = 'd8910cf0dd90be84c07df179512cf2e36659a92726e67e8dc8bc8b457fe6e5ee' - After installation, please do node -v
Expected Result:
node should be accessible from all location and in from all users
Actual Result:
node is only accessible from the below location
/usr/local/nodejs-binary-7.9.0/bin/
Terminal output:
root@ip-10-50-158-46:/usr/local/nodejs-binary-7.9.0/bin# cd /usr/local/nodejs-binary-7.9.0/bin/
root@ip-10-50-158-46:/usr/local/nodejs-binary-7.9.0/bin#
root@ip-10-50-158-46:/usr/local/nodejs-binary-7.9.0/bin# ls
node npm
root@ip-10-50-158-46:/usr/local/nodejs-binary-7.9.0/bin# node -v
v7.9.0
root@ip-10-50-158-46:/usr/local/nodejs-binary-7.9.0/bin# exit
exit
xxxxxx@ip-10-50-158-46:~$ node -v
WARNING:root:could not open file '/etc/apt/sources.list.d/yarn.list'
The program 'node' can be found in the following packages:
- node
- nodejs-legacy
Try: sudo apt-get install
xxxxxx@ip-10-50-158-46:~$
Hi.
You should to add /usr/local/nodejs-binary-7.9.0/bin/
to PATH env.
export PATH=/usr/local/nodejs-binary-7.9.0/bin:$PATH
.
Hi pandamako,
Thank you for replying, I thought that environment things handled in the cookbook and it is not working for me.
I built cookbook https://github.com/rentmania/nodejs-cookbook and after cook i have node -v
accessible from all users.
Is this a legit fix? I was digging around and there's an actual reason root doesn't have /usr/local/bin
on root's $PATH
on some distros
Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.
This cook book should not update environment variables for the system profile. I think the cookbook is working as designed in this area.