pkg icon indicating copy to clipboard operation
pkg copied to clipboard

opts.pkg undefined

Open seamory opened this issue 3 years ago • 9 comments

What version of pkg are you using?

5.5.2

What version of Node.js are you using?

16.13.0

What operating system are you using?

WSL Ubuntu 20.04, Windows 10

What CPU architecture are you using?

Intel i59400

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

node14-linux-x64

Describe the Bug

[email protected] compression: GZip /usr/local/node/lib/node_modules/pkg/node_modules/prebuild-install/util.js:13 major: opts.pkg.version.split('.')[0], ^

TypeError: Cannot read properties of undefined (reading 'split') at Object.getDownloadUrl (/usr/local/node/lib/node_modules/pkg/node_modules/prebuild-install/util.js:13:29) at Object. (/usr/local/node/lib/node_modules/pkg/node_modules/prebuild-install/bin.js:77:22) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 ./build/bootstrap.sh: 32.1%

Expected Behavior

no TypeError

To Reproduce

if i use pkg without nestjs project, this error will disappear.

seamory avatar Feb 11 '22 01:02 seamory

@seamory Have you found a solution for this?

robinschneider avatar Apr 04 '22 14:04 robinschneider

I encountered a similar error. I am trying to pack a node.js application inside a docker container to a binary file which I want to run in another container.

What version of pkg are you using? 5.5.2

What version of Node.js are you using? 16

What operating system are you using? WSL Ubuntu 20.04, Windows 10

What CPU architecture are you using? Intel i710850 - amd64

What Node versions, OSs and CPU architectures are you building for? node16-linux-x64 (I also tried other node versions, like 10 and 14, but did not work either)

Describe the Bug /usr/local/lib/node_modules/pkg/node_modules/prebuild-install/util.js:13 major: opts.pkg.version.split('.')[0], ^

TypeError: Cannot read properties of undefined (reading 'split') at Object.getDownloadUrl (/usr/local/lib/node_modules/pkg/node_modules/prebuild-install/util.js:13:29) at Object. (/usr/local/lib/node_modules/pkg/node_modules/prebuild-install/bin.js:77:22) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47

JoshuaFaber avatar Apr 05 '22 08:04 JoshuaFaber

@seamory Have you found a solution for this?

sorry, i had not found the solution for this, but the error not take any effects to the result.

seamory avatar Apr 05 '22 12:04 seamory

Same problem here, invoking this command: pkg --targets node16-linux-x64 .

birgersp avatar Apr 29 '22 08:04 birgersp

I had this error when one of the packages in node_modules did not have a version in their package.json.

In my case it was the generated .prisma/client

jnorris441 avatar Jun 09 '22 23:06 jnorris441

@jnorris441 , have you solved your .prisma problem? I had the same problem.

grimmerk avatar Jul 22 '22 12:07 grimmerk

@grimmer0125 no I put a version entry into my prisma client package.json before building using pkg

jnorris441 avatar Jul 22 '22 14:07 jnorris441

Here's a PR that fixes this in the underlying library https://github.com/prebuild/prebuild-install/pull/184

jonluca avatar Aug 03 '22 18:08 jonluca

Closing that PR - the issue is most likely a local package in your monorepo or your root package.json missing a version field.

jonluca avatar Aug 03 '22 21:08 jonluca

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 Nov 02 '22 00:11 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 Nov 08 '22 00:11 github-actions[bot]