# Installing the node\_modules

**URL:** <https://forum.ansible.com/t/installing-the-node-modules/32665>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 13, 2020, 12:10am UTC](https://forum.ansible.com/t/installing-the-node-modules/32665 "2020-04-13T00:10:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sai\_kumar](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@sai\_kumar](https://forum.ansible.com/u/sai_kumar)\
**Post date:** [April 13, 2020, 12:10am UTC](https://forum.ansible.com/t/installing-the-node-modules/32665/1 "2020-04-13T00:10:02Z")

</div>

I did the node package managers with nvm

nvm is installed in usr profile directory ~/.nvm  
node is installed at ~/.nvm/versions/v10.19.0 , v13.10.0

now i need to install the node modules

I tried with command: bash -c ‘sudo -iu user npm i -g jest’

I am able to install CentOS 7 successfully at the location: ~/.nvm/versions/node/v10.19.0/bin

**…/lib/node\_modules/jest/bin/**

whereas on ubuntu, i getting the error npm command not found. even when i execute the same command at ubuntu terminal.

Can someone throw light to work with Ubuntu -18.04

- name: Run npm tasks

become: yes  
become\_user: ‘{{ linux.user.name }}’

command: bash -c ‘sudo -iu {{ linux.user.name }} npm install -g {{ item }}’  
loop: “{{ linux.npm\_packages }}”

or

- name: Run npm tasks  
become: yes  
become\_user: ‘{{ linux.user.name }}’  
shell: bash -lc ‘npm install -g {{ item }}’  
loop: “{{ linux.npm\_packages }}”

Using module file /Library/Python/2.7/site-packages/ansible/modules/commands/command.py

Pipelining is enabled.

EXEC [‘/usr/local/bin/docker’, ‘exec’, ‘-i’, u’ubuntu1804’, u’/bin/sh’, ‘-c’, u’/bin/sh -c 'sudo -H -S -n -u appuser /bin/sh -c '“'”'echo BECOME-SUCCESS-kqeikkibwtmhhlcrdqrmllsljsoxrezm ; /usr/bin/python'“'”' && sleep 0'']

failed: [ubuntu1804] (item=cypress) =\> {

“ansible\_loop\_var”: “item”,

“changed”: true,

“cmd”: “bash -lc ‘npm install -g cypress’”,

“delta”: “0:00:00.624562”,

“end”: “2020-04-13 00:05:29.561745”,

“invocation”: {

“module\_args”: {

“\_raw\_params”: “bash -lc ‘npm install -g cypress’”,

“\_uses\_shell”: true,

“argv”: null,

“chdir”: null,

“creates”: null,

“executable”: null,

“removes”: null,

“stdin”: null,

“stdin\_add\_newline”: true,

“strip\_empty\_ends”: true,

“warn”: true

}

},

“item”: “cypress”,

“msg”: “non-zero return code”,

“rc”: 127,

“start”: “2020-04-13 00:05:28.937183”,

“stderr”: “bash: npm: command not found”,

“stderr\_lines”: [

“bash: npm: command not found”

],

“stdout”: “”,

“stdout\_lines”:

}

META: ran handlers

META: ran handlers

Regards,

Muni
