简体   繁体   English

无法在Atom编辑器上运行Javascript代码

[英]Cannot run Javascript code on Atom editor

Atom is not able to run javascript code for some reason, I have tried both packages such as atom runner and atom script with no success. 由于某种原因,Atom无法运行javascript代码,我尝试了两个程序包(例如atomRunner和atom脚本)都没有成功。 I have Node JS installed on my computer and javascript package installed on Atom, I have no idea why it does not work. 我在计算机上安装了Node JS,在Atom上安装了javascript程序包,我不知道为什么它不起作用。 Here is the code which is returned after trying to run a javascript prompt. 这是尝试运行javascript提示符后返回的代码。

 C:\Users\artisan\Desktop\hi.js:1
(function (exports, require, module, __filename, __dirname) { var hi = prompt("wt");
                                                                       ^

ReferenceError: prompt is not defined
    at Object.<anonymous> (C:\Users\artisan\Desktop\hi.js:1:72)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

prompt() is a function which is implemented by Web Browsers. hint()是由Web浏览器实现的功能。 In serversided JS you can't use this function. 在服务器端JS中,您不能使用此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM