1

我在 Windows 7 上安装了“Enide Studio 2014”。然后我创建了一个“Node.js Express Project”。一切顺利,创建了一个新项目。我能够毫无问题地运行它。

由于每次我对代码进行任何更改时停止和启动节点服务器都会在开发过程中进行不必要的努力,因此我希望 Eclipse 能够“监控”更改并相应地重新启动节点。由于 nodeclipse 为此提供了一个选项,因此我尝试将其永久配置为节点监视器。

Nodeclipse 首选项中,节点路径应设置为“D:\Software\Development\NodeJS\node.exe”。Forever 安装在“D:\Software\Development\NodeJS\node_modules\forever\bin\forever”中,所以我将“节点监视器路径”设置为这样。

在此之后,我无法再次运行该项目。

当我检查控制台输出时,发出(失败)的命令是:

node D:\Software\Development\NodeJS\node_modules\forever\bin\forever D:\calismaalani\nodejs\deneme\app.js

我复制了命令行并自己在命令窗口上发出它并得到:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
error:   Cannot start forever
error:   script D:\Software\Development\NodeJS\D:\calismaalani\nodejs\deneme\app.js does not exist.

可以清楚地看到,Nodeclipse 试图将 node_home 路径添加到我的应用程序的绝对路径中。我试图设置一些环境变量,但无法为我的应用程序找到正确的路径。

这里有什么问题?我怎样才能解决这个问题?

4

2 回答 2

0

由于 Nodeclipse 0.17 Run with Node 监视器是隐藏的,因为它提出了更多问题然后解决了。

请通过 CLI 启动,forever并且TCF-Terminal是与 Eclipse 的很好的 shell 集成,因此您可以在单独的选项卡中为不同的项目运行多个永久实例。

于 2014-10-08T07:17:17.353 回答
0

您可以在 Nodeclipse 首选项中指定“节点选项”路径,D:\Software\Development\NodeJS\node_modules\forever\bin\forever --sourceDir .并且 Nodeclipse 应该自动永远使用来启动您的节点 Js 应用程序。

我使用 nodeclipse 版本 1.0.2.x 并使用 nodemon 来监视应用程序,它对我来说很好用。

编辑: 在您的情况下,您不能将绝对路径传递给forever。如果需要,可以使用“--sourceDir.”选项。--sourceDir 和“。” 选项查找应用程序的完整路径。因此,您的命令将如下所示:

node D:\Software\Development\NodeJS\node_modules\forever\bin\forever --sourceDir . D:\calismaalani\nodejs\deneme\app.js

您需要将节点监视器路径指定为 D:\Software\Development\NodeJS\node_modules\forever\bin\forever --sourceDir .

如果您使用的是nodemon,则需要将路径指定为C:\Users\ashwin_valento\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js --watch

于 2016-07-05T04:53:29.193 回答