-1

I've followed this tutorial for Rabbitmq in Javascript. These are the codes: https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/javascript-nodejs/src/send.js

https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/javascript-nodejs/src/receive.js

But, when I try to run them with ./send.js and/or ./recv.js it gives me "Permission denied" error.

I look for some solutions but I don't understand, or I find something about IE (that it's not my case) - plus I don't think the problem is the browser (?) If it's so... why? :/

Sara
  • 37
  • 1
  • 5
  • Possible duplicate of [Is it possible to run JavaScript files from the command line?](https://stackoverflow.com/questions/12659778/is-it-possible-to-run-javascript-files-from-the-command-line) – Thomas Feb 04 '18 at 22:01

2 Answers2

2

Well, i think you are wrong with few things... you are trying to run it without node or an interpreter.

  • If a file it's not a module like file, you should use node ./file.js
  • If a file it's a module you must to use something like this var myModule = require('./myModule.js); and use its functions.
  • If a file it's a browser script you should use like this <script src="/file.js"></script> and use its functions.

I don't know that software and how it works, but that are the essentials usages of common javascript files.

jesusgn90
  • 525
  • 2
  • 12
  • Thank you! I'm gonna try! This is the first time I use Javascript, I didn't know that... :D – Sara Jan 24 '17 at 11:32
0

You're trying to run Javascript from the command line. This answer details how to do it with Node, with instructions from Command Line Javascript. Here's a quick rundown:

  • Download and install Node
  • Create the file hello.js containing just one line:
    console.log('Hello, world');
  • Running your program is easy; invoke node on the file containing your program:
    node hello.js
Thomas
  • 4,816
  • 5
  • 36
  • 45