node.js plugins failing to install

joecurrin
New Contributor III

Does anyone have any experience automating the install of Node.js plugins?

We are trying to install Node.js plug-ins via a casper self-service policy. The policy just executes the command "/usr/local/bin/npm install -g cordova," I have also tried this as a script as well. If we install via the command line or casper remote there are no issues.

This is the error produced by the policy:

Executing Policy Node.js Cordova Plug-In... [STEP 1 of 1] Running command /usr/local/bin/npm install -g cordova... Result of command: env: node: No such file or directory

This error makes no sense because node is install at /usr/local/bin/

Any help would be greatly appreciated!

2 REPLIES 2

bvrooman
Valued Contributor

The /usr/local/bin/ directory may not be in the $PATH for root. You may want to try logging into the root account on a test box and adding it to see if that's the issue.

nessts
Valued Contributor II

No idea what cordova plugin is, however its probably trying to get the users environment or a tty and since it is likely running as root its not going to likely ever work, you need to execute the command as the user most likely. look at this post, for some hints. And if you search for bsexec or running things as the user you should find loads of information. And plenty of scripting examples.