我正在使用pkg将我的节点应用程序打包到一个.exe中,它运行得很好。不过,我遇到的问题是模块通知器没有包含在构建中。当我运行以下命令来生成exe时:
$ pkg . --targets node10-win-x64我明白了:
> 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所在的目录中?
发布于 2021-05-08 12:44:30
我解决了。在我的项目中,在Windows 10 (64位)上,我使用了“节点通知器”,并收到了类似于上面的警告。上述警报是一个警告,即可执行文件创建后必须位于子文件夹中。
然而,在Windows 10 (64位)中,“节点通知器”使用"soreToast-x64.exe“而不是"soreToast.exe”。
您可以按以下顺序进行。
npm -g pkg
https://stackoverflow.com/questions/61099459
复制相似问题