• notice
  • Congratulations on the launch of the Sought Tech site

How to build a NodeJS development environment through Sublime

1. Download nodejs

After downloading and installing Node, refer to the online tutorial to configure environment variables.

2. Download sublime text3

Download the English version as much as possible

3. Install the sublime text3 package manager

1. Add the node plugin to the package install package, or go directly to the SublimeText-Nodejs plugin ( https://github.com/tanepiper/SublimeText-Nodejs ) to download.

2. After downloading D:\Program Files\SublimeText3\Data\Packages, create a new folder under the Nodejs file name, don't make a mistake, and then throw all the files of the sublimeText-nodejs plug-in downloaded from git into it.

img.png

After downloading, it is SublimeText-Nodejs-master.zip. After opening it directly with the compressed package, throw the file D:\Program Files\SublimeText3\Data\Packages\Nodejsunder

img.png

4. New Nodejs command mode

The point is reached, many of the online talk are not reliable, you can directly open D:\Program Files\SublimeText3\Data\Packages\Nodejs\Nodejs.sublime-buildthis file and edit it with Notepad or Sublime. The editing code is as follows

{  
 "encoding": "GB2312",  
 "cmd": ["taskkill /F /IM node.exe", ""],  
 "cmd": ["node", "$file"]  }

5. Finishing work

In this way, you can create a new node.js file directly in Sublime, run it, and directly under  F7sublime

var http = require('http');  var os = require('os');  http.createServer(function (request, response) {  
 response.writeHead(200, {'Content-Type': 'text/plain'});  
 response.end('Hello World3 \n');  }).listen(3000);  console.log('Server running at http://127.0.0.1:3000/');

6. Doubt

Students will ask, how do I restart node?

1. Manually open the task manager, close the node.exeprocess , and restartF7

2. Install the nodejsplug- supervisor. After installation, use sublime to write the js code of node directly, instead of restarting node back and forth, it will automatically detect js and restart the node port, which is quite comfortable. See the installation method: http:// www.cnblogs.com/pigtail/archive/2013/01/08/2851056.html

The following are relatively valuable reference pages:

  1. http://blog.csdn.net/jwkfreedom/article/details/8450005

  2. http://blog.csdn.net/fan158/article/details/17484403

  3. http://www.cnblogs.com/bluesky4485/p/3928364.html

  4. http://www.hacke2.cn/nodeJS-sublime-3/

  5. http://blog.csdn.net/helem_2013/article/details/17172999

It is recommended to use WebStom, Sublime is more suitable for writing code such as Js, and Webstom can break the point to debug Node.


Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+