【Tool】IntelliJ 搭建Node.js环境

IntelliJ IDEA 开发 Node.js


2019-07-29  14:12:34  by冲冲html

 

1. 配置插件

在IDEA的 file -> setting -> Plugins,右边手动输入“node.js”搜索,而后点击下载,安装完成后要求重启。node

注意:存在 Intellij IDEA 汉化以后没法打开“设置(T)...”的问题

解决方案参考 https://jingyan.baidu.com/article/fb48e8bef2bcb66e622e14d2.html测试

① 前往Intellij安装包的lib文件夹下,找到汉化文件(resources_cn.jar),用压缩软件打开(不用解压缩)。网站

② 将其messages文件夹内的 IdeBundle.properties(系统设置(setting)外观选项加载不出来)、VcsBundle.properties(系统设置(setting)打不开)、UIBundle.properties(定位按钮找不到) 这三个配置文件删除就能够解决对应问题。ui

③ 删除后关闭,确保jar文件还在lib目录下,启动Intellij IDEA。atom

 

2. Demo测试

① 点击新建项目,提供node的2个选项: Node.js 基础模板 和 Node.js Express App 网站spa

② 建立server.js文件.net

var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8888); console.log("nodejs start listen 8888 port!");

③ 完成 Run/Debug 配置插件

注意:存在 Intellij IDEA 汉化以后没法正常使用 “编辑结构...(R)” 的问题

解决参考 https://blog.csdn.net/atomjob/article/details/89462096code

① 前往Intellij安装包的lib文件夹下,找到汉化文件(resources_cn.jar),用压缩软件打开(不用解压缩)。

② 将其messages文件夹内的 ExecutionBundle.properties 删除。

③ 删除后关闭,确保jar文件还在lib目录下,启动Intellij IDEA。

填写须要运行的JS文件

 

3. 运行

控制台输出 node js start listen 8888 port! ,则成功。

打开页面  http://127.0.0.1:8888 或者 localhost:8888 能够看到结果。

参考:https://www.cnblogs.com/duhuo/p/4217083.html

相关文章
相关标签/搜索