如何在WebStorm中运行nodemon? [英] How can I run nodemon from within WebStorm?

查看:415
本文介绍了如何在WebStorm中运行nodemon?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WebStorm IDE(版本7)中使用 nodemon 。 Nodemon监视源文件夹中的一个或多个文件,并在其中一个源文件发生更改时重新启动节点进程(本例中为Express服务器)。

I would like to use nodemon from within the WebStorm IDE (version 7). Nodemon watches one or more files in my source folder and restarts the node process (an Express server in this case), when one of the source files changes.

我如何将WebStorm配置为在运行配置中使用 nodemon ,以便节点进程自动重启?

How do I configure WebStorm to use nodemon in a Run Configuration, so that the node process is automatically restarted?

不使用 nodemon ,我在WebStorm中使用以下配置,但每当我更改源文件中的内容时都必须重新启动节点进程:

Without nodemon, I use the following configuration in WebStorm, but have to restart the node process whenever I change something in the source file:


  • 节点解释器: / usr / local / bin / node

  • 工作目录: / Users / foo / test

  • JavaScript文件: server.js

  • Node interpreter: /usr/local/bin/node
  • Working directory: /Users/foo/test
  • JavaScript file: server.js

这会导致在指定目录中运行 node server.js 的运行配置。

This results in a Run Configuration that runs node server.js in the specified directory.

从命令行,我可以使用以下命令使用 nodemon 来监视文件更改: nodemon server.js 在项目目录中。

From command line, I can use the following command to use nodemon to watch for file changes: nodemon server.js in the project directory.

如何更改WebStorm配置以便它还使用 nodemon

How do I need to change the WebStorm configuration so that it also uses nodemon?

推荐答案

看起来不再需要使用 - exec 的变通方法,至少在使用最新版本的nodemon 和Webstorm 7或8.

It looks like the workaround with --exec isn't necessary anymore, at least when using the newest version of nodemon and Webstorm 7 or 8.

您所要做的就是指定 nodemon的路径(例如节点参数下的 / usr / local / bin / nodemon ):

All you have to do is specify your path to nodemon (e.g. /usr/local/bin/nodemon) under "Node parameters":

@Bela Clark,谢谢确认。

@Bela Clark, thanks for confirming.

这篇关于如何在WebStorm中运行nodemon?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆