I created an rpm package that extract a Node.js project into a specific folder and then I created a postinstall script that cd into that folder and perform an "npm install --production"
#!/bin/bash cd /opt/project npm install --production
The problem is that after rpm unpacks the project I receive the fallowing error:
/var/tmp/rpm-tmp.MbfpY5: line 3: npm: command not found warning: %post(pack-0.0.0-1.noarch) scriptlet failed, exit status 127
Of course npm is installed and, if I execute the same script manually, it works. I read that the exit status 127 is also related to a bug in selinux policies, but I tried to disable selinux completely and received the same error.
I also have the exact same code as a .deb and its working flawless there, but I can't make it work in CentOS.
Any idea where the problem might be?