Search code examples
node.jsbashpuppetpm2

PM2 inside bash script deployed and executed with puppet not working


    #!/bin/bash
    yum -y install gcc-c++
    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
     yum -y install git
    /usr/local/bin/npm install pm2 -g
    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 Node forever /usr/bin/env: node: No such file or directory However not working for me. Any help will be much appreciated.


Solution

  • I had to add environment variable for puppet exec resource. That was not a problem for node.