Detailed instructions for configuring Sublime Text Development for node. JS (Windows) including SUB2 and sub3 differences

Source: Internet
Author: User
Tags sublime text



1, first install sublime Text 2 or 3 can be



2. Download the sublime Text Nodejs plugin to get the ZIP package (which will be described in the following article)



3, the download after the decompression directly renamed to Nodejs (must be the name, otherwise sub2 edit the default file will be error) put to preferences--> browseBrowse Packagesthe folder where the package is located.



4. Open the Nodejs folder to find the root directory inside the Nodejs.sublime-build file as follows


 
{ "cmd": ["node", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.js", "shell":true, "encoding": "cp1252", "windows":
    { "cmd": ["taskkill /F /IM node.exe & node", "$file"]
    }, "linux":
    { "cmd": ["killall node; node", "$file"]
    }
}


Change cp1252 to gb2312 unless you are an English system, otherwise garbled



If it is sublime Text 3 will:

Otherwise the report can not find the path error, if it is 2, do not change otherwise every building a node process.



Restart the program!!






5. Configure the Nodejs path Preferences-->package Setting-->nodejs-->default as follows:


 
 
{
  // save before running commands
  "save_first": true,
  // if present, use this command instead of plain "node"
  // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  "node_command": "C:\\Program Files\\nodejs\\node.exe",
  // Same for NPM command
  "npm_command": "C:\\Program Files\\nodejs\\npm.cmd",
  // as ‘NODE_PATH‘ environment variable for node runtime
  "node_path": true,

  "expert_mode": false,

  "ouput_to_new_tab": false
}


The tool in the run is not related to gray, each press Ctr+b compile, the following will be in time to output results.



For the difference between 2 and 3:



1. If the node. JS plugin is installed with the package control, SUB2 will be installed in:



C:\Users\Administrator\AppData\Roaming\Sublime the Text 2\packages\ directory.



And SUB3 will be installed in:



C:\Program files\sublime Text 3\data\installed Packages directory and will not be decompressed, each time the SUB3 is launched in the cache (in order to green), At this time, edit the Nodejs.sublime-build file to use the zip to open the edit and save the restart software.



2. If you install the node. JS plugin with the package control, you will find that you cannot edit path Preferences-->package Setting-->nodejs-->default, this time edit path Preferences-->package Setting-->nodejs-->user He will overwrite the default, in fact this is the official recommended practice.








Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.