Test HTTP Requests Tools Blog Learn Quizzes Smile API Log In / Sign Up
Test HTTP Requests Tools Blog Learn Quizzes Smile API Log In / Sign Up
« Return to the tutorials list
We have updated the website and our policies to make sure your privacy rights and security are respected.
Click here to learn more about the way our website handles your data.

Remove this message.

You can read this article in: English :: EspaƱol

Setting up Sublime Linter on Ubuntu

Daniel Gheorghe Difficulty: 25 / 50 Tweet

Hi there!

I recently switched to Ubuntu as my primary operating system and one of the issues I've encountered was setting up Sublime Linter to work properly with CSS, PHP and JavaScript linting. This gave me the idea to write this tutorial on how you can set Sublime Linter to play nicely on Ubuntu.

Install PHP, Nodejs, NPM, JSHint and CSSLint

Instead of installing PHP on its own, I've installed it alongside Apache and MySQL using tasksel so that I can enjoy the full LAMP stack locally. To install run the commands below and follow the on-screen instructions.

    sudo apt-get install tasksel
    sudo tasksel install lamp-server

The problem with installing Nodejs and use its modules as linters on Ubuntu is that you need to install the 'legacy' version in order to create the correct paths inside '/usr/bin'. Otherwise Sublime Linter will fail because it can not execute node from alternate paths. This being said, run the commands below one by one to install Nodejs, NPM, JSHint and CSSLint.

    sudo apt-get install nodejs-legacy
    sudo apt-get install npm
    sudo npm install -g jshint
    sudo npm install -g csslint

If everything went well with the installations, you should be able to see that inside '/usr/bin' there's a nodejs file, but because you installed the legacy version you will also have a symlink called node that points to nodejs which allows Sublime Linter commands to run correctly.

Install and configure Sublime Linter

Assuming you have Package Control installed in Sublime Text 3 you can now go ahead and install Sublime Linter and it's sub modules SublimeLinter-php, SublimeLinter-csslint and SublimeLinter-jshint. Once you've done that, go to Preferences » Package Settings » SublimeLinter » Settings-User and modify the configuration file by adding the correct paths to php and the node modules inside paths.linux[]. If you can't find the configuration json inside Settings-User you can copy it from the Settings-Default file and then modify it.

      "paths": {
          "linux": [
              "/usr/bin/php -l"
          "osx": [],
          "windows": []

Now restart Sublime and start coding!