2
#!/bin/bash

# install needed RPMS
yum -y install gcc-c++ git

# downlaod and compile node
wget https://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz
tar -xvzf  node-v0.12.7.tar.gz
cd node-v0.12.7
./configure
make
sudo make install

# install pm2 via npm
/usr/local/bin/npm install pm2 -g

# start processes.json
cd /home/admin/Order-Management/
/usr/local/lib/node_modules/pm2/bin/pm2 start processes.json

The above script run perfectly when I run it locally but when I try to execute it with puppet on the client machine the last line throwing the following error.

    /usr/bin/env: node: No such file or directory

I am using RedHat 6 master and RedHat 6 client. I saw a solution here https://stackoverflow.com/questions/30281057/node-forever-usr-bin-env-node-no-such-file-or-director However it's not working for me.

1 Answer 1

0

Probably node is not in your PATH during execution with puppet. Try this script:

#!/bin/bash

# install needed RPMS
yum -y install gcc-c++ git

# downlaod and compile node
wget https://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz
tar -xvzf  node-v0.12.7.tar.gz
cd node-v0.12.7
./configure
make
sudo make install

# install pm2 via npm
/usr/local/bin/node /usr/local/bin/npm install pm2 -g

# start processes.json
cd /home/admin/Order-Management/
/usr/local/bin/node /usr/local/lib/node_modules/pm2/bin/pm2 start processes.json

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.