Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool can't be packaged #275

Open
cnovel opened this issue May 10, 2023 · 1 comment
Open

Tool can't be packaged #275

cnovel opened this issue May 10, 2023 · 1 comment

Comments

@cnovel
Copy link

cnovel commented May 10, 2023

I need to package the tool as an exe for easy validation on build machines of our produced 3D tiles.
I'm trying to package it with pkg, but I hit the following issue:

D:\dev\3d-tiles-validator> npx pkg .
> pkg@5.8.1
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@cesium\engine\index.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@cesium\widgets\index.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\index.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\deflate.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\inflate.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\configuration.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\util\mime-type.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\codec-pool.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\util\default-mime-type.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\codec.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\codec-pool-worker.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\crc32.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\aes-crypto.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\zip-crypto.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\util\encode-text.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\3d-tiles-validator\node_modules\@zip.js\zip.js\lib\core\codecs\sjcl.js

When executing the resulting exe, this is the error message:

D:\dev\3d-tiles-validator\dist>3d-tiles-validator.exe --version
pkg/prelude/bootstrap.js:1872
      throw error;
      ^

Error: Cannot find module 'C:\snapshot\3d-tiles-validator\node_modules\cesium\Build\CesiumUnminified\index.cjs'
Require stack:
- C:\snapshot\3d-tiles-validator\node_modules\cesium\index.cjs
- C:\snapshot\3d-tiles-validator\node_modules\3d-tiles-tools\build\traversal\cesium\BoundingVolumeDerivation.js
- C:\snapshot\3d-tiles-validator\node_modules\3d-tiles-tools\build\traversal\ImplicitTraversedTile.js
- C:\snapshot\3d-tiles-validator\node_modules\3d-tiles-tools\build\traversal\ExplicitTraversedTiles.js
- C:\snapshot\3d-tiles-validator\node_modules\3d-tiles-tools\build\traversal\ExplicitTraversedTile.js
- C:\snapshot\3d-tiles-validator\node_modules\3d-tiles-tools\build\index.js
- C:\snapshot\3d-tiles-validator\build\base\readJsonUnchecked.js
- C:\snapshot\3d-tiles-validator\build\main.js
- C:\snapshot\3d-tiles-validator\build\main
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46)
    at Module._load (node:internal/modules/cjs/loader:787:27)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\snapshot\3d-tiles-validator\node_modules\cesium\index.cjs:13:18)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\cesium\\index.cjs',
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\3d-tiles-tools\\build\\traversal\\cesium\\BoundingVolumeDerivation.js',
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\3d-tiles-tools\\build\\traversal\\ImplicitTraversedTile.js',
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\3d-tiles-tools\\build\\traversal\\ExplicitTraversedTiles.js',
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\3d-tiles-tools\\build\\traversal\\ExplicitTraversedTile.js',
    'C:\\snapshot\\3d-tiles-validator\\node_modules\\3d-tiles-tools\\build\\index.js',
    'C:\\snapshot\\3d-tiles-validator\\build\\base\\readJsonUnchecked.js',
    'C:\\snapshot\\3d-tiles-validator\\build\\main.js',
    'C:\\snapshot\\3d-tiles-validator\\build\\main'
  ],
  pkg: true
}

Node.js v18.5.0

Step for reproducing:

  • Clone the repo
  • npm install
  • npm run prettier
  • npm run package
  • npx pkg.

I'm using node 18.8.0, pkg 5.8.1.

@javagl
Copy link
Contributor

javagl commented Jun 11, 2023

Sorry for the delay here.

We have not yet investigated the options for packaging the validator other than as an npm package. So I cannot say much about the functionality of pkg as a whole, reasons for the error, or possible configuration options that might affect the results (or cause or prevent the error that you see, respectively).

The warning message seems to be quite common ( vercel/pkg#641 ) and one could start by going through this ... loooong ... issue and trying to apply the workarounds there. Otherwise, i.e. if you already have ideas for a possible solution, then we could try to investigate these in a more goal-directed way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants