salt icon indicating copy to clipboard operation
salt copied to clipboard

Command 'npm --version' failed with return code: 127

Open fbretel opened this issue 11 years ago • 6 comments

Hi all,

Since upgrading to 2015.5.0 on RHEL5 nodes, and although I can't seem to find any of my states related to npm/nodejs, I get:

[ERROR   ] Command 'npm --version' failed with return code: 127
[ERROR   ] output: /bin/sh: npm: command not found

In the logs:

2015-05-20 12:17:59,209 [salt.loaded.int.module.cmdmod][INFO    ][2946] Executing command 'npm --version' in directory '/home/fbretel'
2015-05-20 12:17:59,215 [salt.loaded.int.module.cmdmod][ERROR   ][2946] Command 'npm --version' failed with return code: 127
2015-05-20 12:17:59,216 [salt.loaded.int.module.cmdmod][ERROR   ][2946] output: /bin/sh: npm: command not found

This doesn't happen on more recent RHEL flavors (6 or 7).

           Salt: 2015.5.0
         Python: 2.6.8 (unknown, Feb 18 2015, 08:19:08)
         Jinja2: 2.5.5
       M2Crypto: 0.21.1
 msgpack-python: 0.4.5
   msgpack-pure: Not Installed
       pycrypto: 2.3
        libnacl: Not Installed
         PyYAML: 3.08
          ioflo: Not Installed
          PyZMQ: 14.5.0
           RAET: Not Installed
            ZMQ: 4.0.5
           Mako: Not Installed

Something wrong in my setup (apart from the old Linux distribution) ?

fbretel avatar May 20 '15 10:05 fbretel

salt-minion installed from https://copr.fedoraproject.org/coprs/saltstack/salt-el5/.

fbretel avatar May 20 '15 15:05 fbretel

Thanks @fbretel for this report. Was this working correctly on an older version of salt? If so, which one? And this is happening when you upgraded, right? Not on a clean machine? Can you post what version of npm you have installed on the RHEL 5 box that is failing?

rallytime avatar May 20 '15 15:05 rallytime

@rallytime this issue did not occur on the previous installed rpm: salt-minion-2014.7.5-1. It appeared when upgrading from 2014.7.5-1 to 2015.5.0-1. The strange thing is neither npm nor nodejs are installed on the RHEL5 boxes and I can't find any of my states related with these packages.

But it turns out I have few RHEL5 boxes on which the issue does not occur.

I tried to disable rules specific to the ill nodes, without success. I'm not sure about how to reproduce the problem on the healthy production nodes... Any hint on what could trigger the call the npm --version ?

fbretel avatar May 20 '15 16:05 fbretel

Ok, to clarify, you're saying that you don't have any states related to npm or nodejs, but you're seeing that error, correct? The only place in the code that calls npm --version is in salt/modules/npm.py.

rallytime avatar May 20 '15 16:05 rallytime

Correct: I don't have any states related to npm or nodejs, but I'm seeing that error.

fbretel avatar May 20 '15 20:05 fbretel

Ok found the origin! Had a node/npm install in /usr/local. So npm was found by salt.utils.which, but obviously not by salt['cmd.run']. This was in 2014.7, but has seemingly been fixed in 2015.5.

fbretel avatar Nov 04 '16 09:11 fbretel