pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Warning Cannot include file %1 into executable - pkg error

Open frodoe7 opened this issue 2 years ago • 6 comments

What version of pkg are you using?

5.7.0

What version of Node.js are you using?

16.14.0

What operating system are you using?

macOS

What CPU architecture are you using?

Quad-Core Intel Core i7

What Node versions, OSs and CPU architectures are you building for?

node16-linux-x64, node16-macos-x64, node16-win-x64

Describe the Bug

Here's the output after running pkg index.js

Targets not specified. Assuming: node16-linux-x64, node16-macos-x64, node16-win-x64

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. %1: node_modules/open/xdg-open %2: path-to-executable/xdg-open

Looks there's an issue between pkg and node-notifier package https://github.com/mikaelbr/node-notifier

A similar issue https://github.com/mikaelbr/node-notifier/issues/220#issuecomment-841725820

Anyone have any ideas how to fix that?

Expected Behavior

To bundle the file correctly and show notifications from that package node-notifier

To Reproduce

Build a minimal project with node-notifier and try to run any notification

will work on the development environment, but after bundling with pkg, will fire these warnings and won't show any notifications

frodoe7 avatar Jun 15 '22 13:06 frodoe7

I got the same error with package "level": "^7.0.0"

Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules/leveldown/prebuilds %2: path-to-executable/prebuilds Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules/leveldown/prebuilds %2: path-to-executable/prebuilds

Devilsmaul avatar Jun 21 '22 11:06 Devilsmaul

reading the output more carefully i was able to fix this issue. i had to copy the prebuilds from %1: node_modules/leveldown/prebuilds into my executable directory in the folder prebuilds

image

Devilsmaul avatar Jun 21 '22 12:06 Devilsmaul

I have the same issue, also trying to use node-notifier with pkg OS: Windows 10 64bit Node: 16.15.1 Output

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

apparently #1021. didn't fix this issue

AliSawari avatar Jun 27 '22 13:06 AliSawari

I have the same error.

Cannot include file %1 into executable. The file must be distributed with executable as %2. %1: node_modules\open\xdg-open %2: path-to-executable/xdg-open

Any ideas ? I try to copy/paste the module in the exectuable folder... but nothing :/

mazero avatar Aug 17 '22 08:08 mazero

For me same issue:

> [email protected]
> Targets not specified. Assuming:
  node18-linux-arm64, node18-macos-arm64, node18-win-arm64
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: ../node_modules/puppeteer/.local-chromium
  %2: path-to-executable/puppeteer
> Warning Failed to make bytecode node18-arm64 for file /snapshot/<PROJECT>/build/app.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/<PROJECT>/build/app.js
> Warning Failed to make bytecode node18-arm64 for file C:\snapshot\<PROJECT>\build\app.js

MariuzM avatar Aug 30 '22 09:08 MariuzM

@MariuzM have you tried to copy /node_modules/puppeteer/.local-chromium into path-to-executable/puppeteer ?

Devilsmaul avatar Sep 14 '22 13:09 Devilsmaul

can anyone have the solution? got the same issue with sharp.

Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules\sharp\build\Release %2: path-to-executable/sharp/build/Release

rajajwaliya avatar Nov 10 '22 13:11 rajajwaliya

i've got same error with sharp, and find no solution

can anyone have the solution? got the same issue with sharp.

Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules\sharp\build\Release %2: path-to-executable/sharp/build/Release

wlc015f avatar Dec 08 '22 09:12 wlc015f

it is resolved. I am using caxa npm.

rajajwaliya avatar Dec 08 '22 09:12 rajajwaliya

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar Mar 09 '23 00:03 github-actions[bot]

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

github-actions[bot] avatar Mar 15 '23 00:03 github-actions[bot]

image

good1uck avatar Jul 16 '23 23:07 good1uck

Try above

good1uck avatar Jul 16 '23 23:07 good1uck