admin管理员组

文章数量:1434372

I've followed this tutorial for Rabbitmq in Javascript. These are the codes: .js

.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? :/

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

https://github./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? :/

Share Improve this question asked Jan 24, 2017 at 11:18 SaraSara 571 silver badge5 bronze badges 1
  • Possible duplicate of Is it possible to run JavaScript files from the mand line? – Thomas Commented Feb 4, 2018 at 22:01
Add a ment  | 

2 Answers 2

Reset to default 3

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 mon javascript files.

You're trying to run Javascript from the mand 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

本文标签: Javascript permission deniedStack Overflow