Recently, I have been studying Nodejs development. as the saying goes, to do a good job, you must first sharpen the tool. of course, you must find a handy editor to start. Here we chose SublimeText3. apart from the beautiful user interface, what attracts me most is its plug-in extension function and cross-platform features. 1. download nodejs, install OK, and configure environment variables.
2. download sublime text3
3. add the node plug-in the package install package (or directly go to the SublimeText-Nodejs plug-in (https://github.com/tanepiper/SublimeText-Nodejs) to download the plug-in, after the download, in D: \ Program Files \ SublimeText3 \ Data \ Packages do not make a mistake in creating a folder named Nodejs file name, and then throw all the Files downloaded from git)
Download sublimetext-nodejs-master.zip. open the package directly and then drop the file under D: \ Program Files \ SublimeText3 \ Data \ Packages \ Nodejs.
4. None of the above is the focus.
Many of the information on the Internet is unreliable. you can directly open D: \ Program Files \ SublimeText3 \ Data \ Packages \ Nodejs. use Notepad or sublime to edit the sublime-build file. edit the code as follows:
{ "encoding": "GB2312", "cmd": ["taskkill /F /IM node.exe", ""], "cmd": ["node", "$file"] }
5. OK, so that you can create a node. js file in sublime directly and run it. then, run F7 under 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. I asked my colleagues how to restart the node. sorry, I didn't find the final solution.
1. manually open the Task Manager, shut down the node.exe process, and re-run F7
2) install the node. js plug-in and supervisor globally. after installation, directly use sublime to write the node's js code, so you don't need to restart the node back and forth. it will automatically detect js, restart the node port, which is quite comfortable.
The above is all the content of this article. I hope you will like it.