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.
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\Nodejs
under
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-build
this 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 F7
sublime
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.exe
process , and restartF7
2. Install the nodejs
plug- 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:
http://blog.csdn.net/jwkfreedom/article/details/8450005
http://blog.csdn.net/fan158/article/details/17484403
http://www.cnblogs.com/bluesky4485/p/3928364.html
http://www.hacke2.cn/nodeJS-sublime-3/
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.
0 Comments