0

I have hosted a nodejs app on azure linux. Now, I am trying to run command from my machine to invoke node js cli command. I am looking for an ability to run the script from my local machine on server.

I am trying

az vm run-command invoke -g xxx -n yyy --command-id RunShellScript --scripts “NODE_ENV_VAR_LIST node dist/app.js arg1 “

Output , it say provisioning is successful but throw error while running

"Enable succeeded: \n[stdout]\n\n[stderr]\nmodule.js:549\n    throw err;\n    ^\n\nError: Cannot find module '/var/lib//run-command/download/2/dist/app.js'\n    at Function.Module._resolveFilename (module.js:547:15)\n    at Function.Module._load (module.js:474:25)\n    at Function.Module.runMain (module.js:693:10)\n    at startup (bootstrap_node.js:188:16)\n    at bootstrap_node.js:609:3\n",

any help is appreciated?

1
  • Any updates on this question? Does it solve your problem? If it works for you please accept it. Commented Feb 1, 2021 at 2:23

1 Answer 1

1

I think the error gives enough message. Let's analyze it again. The success means the script NODE_ENV_VAR_LIST node dist/app.js arg1 was executed in the VM, if it does not succeed, then it means VM does not execute the command.

And the error after is about the command, it means there is something wrong with the command itself. And the issue is also clear, you use the relative path and it causes the issue. You need to use the absolute path for the app file in the command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.