Atom text editor can't run JavaScript in Ubuntu 16.04

0

1

I'm using Atom text editor in my Ubuntu 16.04, however I can't run any JavaScript code in it.

Even from terminal I get the following error:

Unable to run node. Did you start Atom from the command line?

atom .

Is it in your PATH?

PATH:/home/gangov/bin:/home/gangov/.local/bin:/home/gangov/bin:/home/gangov/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

I really can't tell what's going on, and I will appreciate your help.

gangov

Posted 2016-11-17T17:59:38.280

Reputation:

You need to install atom cli command to start from terminal. – randominstanceOfLivingThing – 2016-11-17T18:01:05.040

1

Possible duplicate of Open Atom editor from command line

– randominstanceOfLivingThing – 2016-11-17T18:01:34.657

@randominstanceOfLivingThing Atom runs js natively "out of the box" when started the usual way by clicking the Atom icon without installing any other packages including atom cli command. – karel – 2017-05-13T22:54:53.110

Answers

0

Atom text editor has the ability to run JavaScript code from its built-in JavaScript console which is located at the bottom of the Dev Tools pane. It's not necessary to start Atom text editor from the terminal to access the console, just start Atom the usual way by clicking the Atom icon.

enter image description here

To open the Dev Tools pane press the keyboard shortcut Ctrl+Shift+I or select Packages -> Command Palette -> Toggle and search for Dev Tools in the Command Palette.

enter image description here

The screenshots are from Ubuntu 16.04, but also apply to other platforms, however the keyboard shortcut is different in macOS.

A bad feature of the built-in JavaScript console is that it is cramped and difficult to read, however there is an Atom package called eval-javascript that allows the user to type the JavaScript code in an ordinary Atom pane and then run it in the console by selecting the code, right-clicking it, and then selecting Eval JavaScript from the popup context menu.

karel

Posted 2016-11-17T17:59:38.280

Reputation: 11 374