我正在使用 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 所在的目录吗?