I can't run javascript file


#1

Hello!

I installed “script” package but whenever I press Run Script I get an error message:

"babel-node’ is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.061s] "


#2

Packages like script work by handing the code off to an external program that is capable of interpreting it. In order to use the babel-node command, you have to install babel-cli. If you don’t have Node installed, do that. If you do have Node, use npm install -g babel-cli.


#3

I have the same problem, but with node but I see a node.exe within the atom install:

Is it normal that node.exe is here? Should it rather be in the bin folder?
Should I cut/past these file into the atom/bin folder?


#4

That’s normal, yes. APM is based off of NPM, which uses Node to install packages. Atom includes a copy of Node for APM to do what it needs to do. There’s another copy of Node inside Atom, because that’s how Electron is set up.

Should I cut/past these file into the atom/bin folder?

No. You should download Node and install it on your computer, even though Atom is already packing two of them. It’s not a large install, and even though you technically can use that particular node.exe for running script, you should not because it’s not guaranteed to be the latest version of Node (or the one you want) and it would be highly suboptimal to rely on a file installed by a program you’re using to run the code you’re writing when that file could change or disappear when the program is updated or uninstalled.


Why do I have several node.exe in atom (plus the one installed on my computer)? [solved]