问题标签 [node-windows]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
22 浏览

node.js - 节点窗口不卸载节点服务

我正在使用 node-windows 安装和卸载节点后端 RESTAPI windows 服务。安装时它工作得很好。但是当我尝试卸载该服务时,它会导致问题。下面是卸载windows节点服务的代码,我还附上了错误的截图

我附上了卸载时的错误截图

0 投票
0 回答
15 浏览

express - express windows-service 停止运行

尝试将 express rest api 设置为 windows-service 我的服务总是在调用 url 时崩溃/停止。

在我的 package.json 之后:

这是我的 server.js

最后是 install.js:

heap out of memory我通过将 设置为 8172 修复了第一个错误--max_old_space_size。现在 Windows 服务启动了。但是调用localhost:1337服务会停止/崩溃server.js stopped running.

我怎样才能解决这个问题?

更新——固定

从安装脚本中删除nodeOption-part 一切似乎都有效。

0 投票
1 回答
499 浏览

node.js - 未找到平台=win 32 的本机构建

重新启动应用程序或停止自动启动并手动启动然后其工作文件后,我在自动启动(Regedit 中的运行条目以自动启动)应用程序中收到以下错误。

错误

这里实际的预构建路径是安装目录%APPDATA%/appname/node_modules,即第一次使用它C:\WINDOWS\System32\node_modules

我比较了这两个过程,我只发现"NativeModule internal/fs/read_file_context"缺少差异。

在电子应用程序中添加了如下预构建。

第一次真的不知道怎么回事。请帮忙。提前致谢 :)

0 投票
0 回答
27 浏览

node.js - Unable to run the window service from os-service npm package run method

*// index.js

the below command runs the application and also install the window-service named "periodic-logger-service" with startup type "Automatic" and i am able to see the service created in window-services manager and if we need to start this window-service we have to start it manually or we need to reboot the machine.

But I want to start this window service automatically from command prompt by passing the run arguments, tried below command as mentioned in the os-service readme docs

this starts the application and the logging is written in the index.log file and when I exit the terminal by cntrl C the application stops, and the window-service ("periodic-logger-service") installed is not running.

Kindly help to resolve this issue. Also wanted to know how to check whether the window-service is already installed or not for below requirements.

  1. if already installed, then i need to run the service
  2. if not installed, then i need to install and run the service.

reference taken - https://www.npmjs.com/package/os-service

0 投票
1 回答
71 浏览

node.js - 如何将节点窗口与服务帐户一起使用?

我正在使用node-windows将我的节点应用程序作为服务运行。因为我打算使用node-expose-sspi,所以我使用 powershell 创建了一个服务帐户(我检查了 Test-ADServiceAccount)。

如果我运行此代码

我得到控制台日志“项目名称已启动...”但未创建服务(我检查了 get-process)。如果我省略 'allowServiceLogon: true' 则创建服务。

如何在节点窗口中指定服务帐户?

0 投票
0 回答
34 浏览

node.js - 将nestjs项目作为Windows服务启动

我们曾经使用 Docker 容器启动 Angular 和 NestJS(基于 node.js)项目。由于各种原因,该解决方案已停止使用,因此我们正在寻找一种在 PC 启动时(或在触发器上)启动这些项目并在发生崩溃时自动重新启动项目的方法。

节点窗口

此包从 node.js 项目构建 Windows 服务。NestJS 基于 node.js,使用 node.js 启动它是这样完成的(在项目的文件夹中):

node PATH_TO_PROJECT\node_modules\@nestjs\cli\bin\nest.js start --config .\tsconfig.build.json

使用的脚本:

安装按预期工作,但在浏览器中,无法访问服务器。

问题

  1. 有没有办法为 NestJS 项目使用节点窗口?
  2. start是否可以在 nest cli命令中使用绝对路径?(例如嵌套开始--config ABSOLUTE_PATH)
  3. 你将如何以同样的方式开始一个 Angular 项目?

谢谢你。

0 投票
0 回答
27 浏览

node.js - Windows Server 2019 上的兼容性问题

两年来,我使用node-windows模块在 windows server 2008 上为我的 node 项目创建了一个 windows 服务。最近我们将我们的版本升级到 Windows Server 2019。然后我尝试在这个新版本的 Windows Server 上重新创建我的服务。我可以创建服务,但它没有启动。

我有这个消息:

Windows 无法在本地计算机上启动 MyService 服务。错误 1067:进程意外终止。

我尝试在 Windows Server 2016 上启动它,它工作正常。我能做些什么来解决这个问题还是只是一个兼容性问题?

0 投票
0 回答
18 浏览

node.js - 在节点应用程序中的日志框架和 console.log 之间进行选择

为了捕获作为 Windows 服务运行的节点应用程序的日志,我使用 bunyan 日志框架,有时出于开发目的,我使用在 CLI 中运行代码并在 console.log() 中捕获日志。因此,例如,我的代码中有很多重复

就像上面的代码一样,无论我想在哪里捕获日志,我都必须编写两行代码而不是增加我的代码长度的一行代码。有没有办法检查应用程序是作为 Windows 服务运行还是在 cli 中运行,所以基于此我可以设置一个变量,console.log or log.error并将基于识别的平台使用?

例如