首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用带有通知程序的pkg构建node.js可执行文件

使用带有通知程序的pkg构建node.js可执行文件
EN

Stack Overflow用户
提问于 2020-04-08 11:20:36
回答 1查看 2.6K关注 0票数 2

我正在使用pkg将我的节点应用程序打包到一个.exe中,它运行得很好。不过,我遇到的问题是模块通知器没有包含在构建中。当我运行以下命令来生成exe时:

代码语言:javascript
复制
$ pkg . --targets node10-win-x64

我明白了:

代码语言:javascript
复制
> pkg@4.4.6
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\notifu\notifu.exe
  %2: path-to-executable/notifier/notifu.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\notifu\notifu64.exe
  %2: path-to-executable/notifier/notifu64.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\terminal-notifier.app\Contents\MacOS\terminal-notifier
  %2: path-to-executable/notifier/terminal-notifier
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\snoreToast\SnoreToast.exe
  %2: path-to-executable/notifier/SnoreToast.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\notifu\notifu.exe
  %2: path-to-executable/notifier/notifu.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\notifu\notifu64.exe
  %2: path-to-executable/notifier/notifu64.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\terminal-notifier.app\Contents\MacOS\terminal-notifier
  %2: path-to-executable/notifier/terminal-notifier
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\snoreToast\SnoreToast.exe
  %2: path-to-executable/notifier/SnoreToast.exe

这似乎是一个常见的问题,它已经暴露了这里,但我无法让这个工作与用户的信息。是否应该将notifu.exe移动到节点的main.js所在的目录中?

EN

回答 1

Stack Overflow用户

发布于 2021-05-08 12:44:30

我解决了。在我的项目中,在Windows 10 (64位)上,我使用了“节点通知器”,并收到了类似于上面的警告。上述警报是一个警告,即可执行文件创建后必须位于子文件夹中。

然而,在Windows 10 (64位)中,“节点通知器”使用"soreToast-x64.exe“而不是"soreToast.exe”。

您可以按以下顺序进行。

  1. 将pkg重新安装到最新版本。

npm -g pkg

  1. 从“\node_modules\node-node~”子文件夹中查找并复制“窥探-x64.exe”。
  2. 在生成的可执行子路径中创建一个文件夹“通知程序”,并复制和粘贴“窥探-x64.exe”。
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61099459

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档