ngfelixl / nodeplotlib

NodeJS plotting library for JavaScript and TypeScript. On top of plotly.js. Inspired by matplotlib.
https://www.npmjs.com/package/nodeplotlib
MIT License
195 stars 24 forks source link

Wrong url when packaged into binary #92

Open DanielBUBU opened 4 months ago

DanielBUBU commented 4 months ago

Describe the bug package into binary using @yao-pkg/pkg@5.11.5 and got error Error: File or directory 'C:\**\PSOandGA\node_modules\nodeplotlib\src\lib\server\web\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script. URL is clearly wrong bcs it added a C:\**\PSOandGA into the url since my node_module url should be D:\NUTN\112\軟式計算\HW\PSOandGA\node_modules, other packages won't get this error, I think it's bcs of the "trying open a web page" part

To Reproduce Steps to reproduce the behavior:

  1. plot something using index.js
  2. npm i @yao-pkg/pkg
  3. add "main": "index.js", to package.json
  4. pkg .
  5. execute exe

Expected behavior Print some plot like this image

Screenshots image

Desktop (please complete the following information):

Additional context console logs:

[Nest] 3956  - 2024-06-07 23:26:27     LOG [NestFactory] Starting Nest application...
[Nest] 3956  - 2024-06-07 23:26:27     LOG [InstanceLoader] ServerModule dependencies initialized +11ms
[Nest] 3956  - 2024-06-07 23:26:27     LOG [InstanceLoader] ServeStaticModule dependencies initialized +1ms
[Nest] 3956  - 2024-06-07 23:26:27     LOG [WebSocketsController] PlotsGateway subscribed to the "readplots" message +33ms
[Nest] 3956  - 2024-06-07 23:26:27     LOG [NestApplication] Nest application successfully started +2ms
[Nodeplotlib] Server running at http://localhost:52118
[Nest] 3956  - 2024-06-07 23:26:27   ERROR [ExceptionsHandler] File or directory 'C:\**\PSOandGA\node_modules\nodeplotlib\src\lib\server\web\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script.
Error: File or directory 'C:\**\PSOandGA\node_modules\nodeplotlib\src\lib\server\web\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    at error_ENOENT (pkg/prelude/bootstrap.js:657:19)
    at findNativeAddonForStat (pkg/prelude/bootstrap.js:1445:32)
    at statFromSnapshot (pkg/prelude/bootstrap.js:1468:25)
    at Object.stat (pkg/prelude/bootstrap.js:1494:5)
    at SendStream.sendFile (C:\snapshot\PSOandGA\node_modules\send\index.js:717:6)
    at SendStream.pipe (C:\snapshot\PSOandGA\node_modules\send\index.js:591:8)
    at sendfile (C:\snapshot\PSOandGA\node_modules\express\lib\response.js:1130:8)
    at ServerResponse.sendFile (C:\snapshot\PSOandGA\node_modules\express\lib\response.js:449:3)
    at renderFn (C:\snapshot\PSOandGA\node_modules\@nestjs\serve-static\dist\loaders\express.loader.js:31:25)
    at Layer.handle [as handle_request] (C:\snapshot\PSOandGA\node_modules\express\lib\router\layer.js:95:5)
[Nest] 3956  - 2024-06-07 23:26:27   ERROR [ExceptionsHandler] File or directory 'C:\**\PSOandGA\node_modules\nodeplotlib\src\lib\server\web\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script.
Error: File or directory 'C:\**\PSOandGA\node_modules\nodeplotlib\src\lib\server\web\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    at error_ENOENT (pkg/prelude/bootstrap.js:657:19)
    at findNativeAddonForStat (pkg/prelude/bootstrap.js:1445:32)
    at statFromSnapshot (pkg/prelude/bootstrap.js:1468:25)
    at Object.stat (pkg/prelude/bootstrap.js:1494:5)
    at SendStream.sendFile (C:\snapshot\PSOandGA\node_modules\send\index.js:717:6)
    at SendStream.pipe (C:\snapshot\PSOandGA\node_modules\send\index.js:591:8)
    at sendfile (C:\snapshot\PSOandGA\node_modules\express\lib\response.js:1130:8)
    at ServerResponse.sendFile (C:\snapshot\PSOandGA\node_modules\express\lib\response.js:449:3)
    at renderFn (C:\snapshot\PSOandGA\node_modules\@nestjs\serve-static\dist\loaders\express.loader.js:31:25)
    at Layer.handle [as handle_request] (C:\snapshot\PSOandGA\node_modules\express\lib\router\layer.js:95:5)

my folder screenshot: image