pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Error! TypeError: derivative.alias.startsWith is not a function when run pkg .

Open joe914 opened this issue 3 years ago • 2 comments

What version of pkg are you using?

5.6.0

What version of Node.js are you using?

14.15.1

What operating system are you using?

Windows

What CPU architecture are you using?

x86_64

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

node14-win-x64

Describe the Bug

It's ok when exec command:

$ pkg -t node14-win-x64 --out-path dist -C GZip src/app.js --public

[email protected] compression: GZip 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 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

But failed when exec "pkg ." because I need to specifiy "scripts" config in package.json : $ pkg .

[email protected] 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 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 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 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 Error! TypeError: derivative.alias.startsWith is not a function at Walker.stepDerivatives (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\walker.js:651:34) at async Walker.step_STORE_ANY (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\walker.js:710:17) at async Walker.step (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\walker.js:775:17) at async Walker.start (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\walker.js:839:13) at async exec (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\index.js:479:24)
at async main (C:\Users\mayn\AppData\Roaming\npm\node_modules\pkg\lib-es5\bin.js:12:5)

package.json: "bin": { "main": "src/app.js" }, "pkg": { "targets": [ "node14-win-x64" ], "outputPath": "dist" }

Expected Behavior

no error

To Reproduce

no

joe914 avatar Apr 22 '22 11:04 joe914

I modify the walker.js to set "scripts" in appendFilesFromConfig function and then execute the following command(bypass package.json) pkg -t node14-win-x64 --out-path dist -C GZip src/app.js

joe914 avatar Apr 26 '22 13:04 joe914

Also seeing this issue after upgrading from 5.3.3 to 5.6.0, and actually getting the error in anything >5.5.0

jdfwarrior avatar May 18 '22 01:05 jdfwarrior

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 Aug 17 '22 00:08 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 Aug 22 '22 00:08 github-actions[bot]