最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Javascript: permission denied - Stack Overflow

programmeradmin11浏览0评论

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
发布评论

评论列表(0)

  1. 暂无评论