Powershell script execution from node js fails

I have a list of Powershell scripts that we’ve developed for a system administration. These scripts are called/executed from a Node JS application using “child_process” module. Everything works fine on my laptop. After transferring Node JS application to Centos7 server I’m receiving errors like this one:

The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I’ve checked Powershell execution policy - everything is set to Unrestricted. I can execute the same scripts from the command line without any error after I ssh to the server as a root user. The only difference I see is that Node JS application is running using a different user.

Found the problem - all modules were installed under /root/.local/share/powershell/Modules directory and nothing was installed under the user’s profile that runs Node JS application. Copied all modules under app user directory /home/ndjs/.local/share/powershell/Modules/ and everything work now.