Node-Notifier と pkg パッケージングの問題を使用した Nodejs について。

例外の説明:
pkg . -t node16-win --out-path dist実行エラーは次のとおりです。

> pkg . -t node16-win --out-path dist
> pkg@5.7.0
> 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-x64.exe
  %2: path-to-executable/notifier/snoretoast-x64.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\snoreToast\snoretoast-x86.exe
  %2: path-to-executable/notifier/snoretoast-x86.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\snoreToast\snoretoast-x64.exe
  %2: path-to-executable/notifier/snoretoast-x64.exe
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\node-notifier\vendor\snoreToast\snoretoast-x86.exe
  %2: path-to-executable/notifier/snoretoast-x86.exe

解決策:ファイルの印刷パス
を確認してくださいpkg パッケージ化前の実行パス: pkg パッケージ化後の実行パス:\node_modules\node-notifier\notifiers\toaster.jsnotifier
ここに画像の説明を挿入
\node_modules\node-notifier\vendor\snoreToast\snoretoast
dist\notifier

解決策:のディレクトリsnoretoast にコピーします。パッケージ化後のファイルの場所:dist

ここに画像の説明を挿入

node_modulesファイルの場所をダウンロードします。
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/WSYLH/article/details/131433541