Sublime Forum

How to install or activate JavaScript Editor?

#1

How can I run a JavaScript editor. I tried creating a new JavaScript build but I get this error message.

Errno 2] No such file or directory: ‘/usr/local/bin/node’
[cmd: [’/usr/local/bin/node’, ‘/Users/ralphjaime/Desktop/CodeAcademy/FizzBuzz.js’]]
[dir: /Users/ralphjaime/Desktop/CodeAcademy]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

0 Likes

#2

It looks like you’re on a Mac, do you have Fix Mac Path installed?

0 Likes

#3

It cannot find the node file. Did you installed Nodejs? If it’s the case, you have to choice:

  • add node to your path (if you’re using the terminal, it’s better)
  • specify the absolute path to node in your build system (if it’s just for this time). Use @OdatNurd’s solution.

Matt

0 Likes

#4

I found the Fix Mac Path link but I don’t know how to install the file. Will you be able to help me that. Thanks for the response.

0 Likes

#5

The easiest way to install packages in Sublime text is using PackageControl. If you haven’t already installed it and you’re using the latest release of Sublime Text 3, select Tools > Install Package Control... from the menu to install it. If PackageControl is already installed, this menu item will not be visible.

To install a package, choose Preferences > Package Control from the menu (under MacOS this is Sublime Text > Preferences > Package Control to open the command palette with all of the package control commands. From here you select the option to install a package.

There will be delay while the package list downloads (you can see a little progress spinner in the status bar at the bottom of the sublime window showing you that it’s working) and then a list of packages will pop up, and you can select it from there to install it.

With all of that said, as @math2001 mentioned, it doesn’t look like you actually have nodejs installed. I misread your original post and thought that the error was due to Sublime not being able to find it (this is a common problem on MacOS due to the way it works). As such my original advice won’t help with this particular problem, although it may be a good idea to do it anyway to curtail any weirdness you might run into in the future.

The error message you’re getting says that it’s trying to execute /usr/local/bin/node but it is failing to do so. Since this contains a specific path, one of two things is wrong here:

  1. You have nodejs installed, but it’s not installed in /usr/local/bin. In that case you need to modify the build system to specify the correct location of the file.

  2. You don’t have nodejs installed at all. In that case, you need to download the installer for MacOS and install it. I recommend the pkg version; Opening that should give you a wizard that walks you through the installation process.

If you are working with option #2 above, watch to see if the installer makes mention of where it’s doing the installation so that if necessary you can modify the sublime build file. It’s been a while since I installed it on my Mac, so I can’t say with 100% certainty that it’s going to put it into /usr/local/bin.

0 Likes

#6

Thanks for your help. I followed your suggestion and installed Node JS Mac OS installer (pkg) and it worked.
Gracie Mille!

2 Likes