Salt: State npm.installed do not recognize "pkgname@version"

Created on 11 Aug 2016  ·  7Comments  ·  Source: saltstack/salt

Description of Issue/Question

Npm state of npm.installed [email protected]: npm.installed: [] does not install the specific version...

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

  • Use npm state like bellow:
filename.sls:
[email protected]:
  npm.installed:
    - name: "[email protected]"
    - user: root
  • Run salt-call state.sls filename -l debug

- “Executing command 'npm install --silent --json --global "elasticdump"' as user 'root' in directory '/root'”

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt: 2015.5.3
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.4.8
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: Not Installed
Tornado: Not Installed
Bug P4 RIoT State Module fixed-pending-your-verification severity-medium

All 7 comments

I changed the code of salt/states/npm.py like below:
194c194

<             cmd_args['pkg'] = pkg
---
>             cmd_args['pkg'] = pkg_name

It will install the specified pkg. But the call result return "ret 1" and error as:

## ID: [email protected]
Function: npm.installed
Name: [email protected]
Result: False
Comment: Error installing '[email protected]': `**err** here but leave empty`
Started: 08:31:38.228159
Duration: 16310.824 ms
Changes: 

I thought it might raise exception of (CommandNotFoundError, CommandExecutionError) as err,CommandExecutionError more likely.
But the result is that I successfully installed '[email protected]'

 sudo npm list -g |grep elasticdump
├─┬ [email protected]

@Dingou I tested this in both 2015.8.11 and 2016.3.2 and i appears to be working as shown in the log file:

[INFO    ] Executing command 'npm install --silent --json  --global [email protected]' as user 'root' in directory '/root'
[ch3ll@thecakeisalie ~]$ npm list --silent --json --global | grep -i elastic -A 4
    "elasticdump": {
      "version": "0.18.0",
      "from": "[email protected]",
      "dependencies": {
        "optimist": {
          "version": "0.6.1",
          "from": "optimist@latest",

Can you give 2015.8.11 or 2016.3.2 a chance and see if that resolves your issue?

Sure,thanks a lot for your reply, I will have a test on version of 2015.8.11,and post a feedback ASAP.

awesome thanks for being willing to try. Let us know :)

Hi, in 2016.3.2, It could work, thanks a lot;
but my product env with version of salt-master and salt-minion 2015.5.3, thus i should update all salt-master and salt-minion to 2016.3.2, is it stable one??

Yep 2016.3.2 is our current stable version. The one issue I would point out to you is #33516 which affects all 2016.3 version as of right now, but we are working on a fix.

Also you can check out the release notes for 2016.3.0-2016.3.2 here for any changes you might want to be aware of. Thanks :) Are you okay to close this now?

ahh,We are using ubuntu but not Redhat series. Thanks a lot for your kindly assistance. Okay to close!

Was this page helpful?
0 / 5 - 0 ratings