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

error with chalk dependency #443

Closed
5 tasks
vvaibhavv11 opened this issue Mar 18, 2025 · 2 comments
Closed
5 tasks

error with chalk dependency #443

vvaibhavv11 opened this issue Mar 18, 2025 · 2 comments
Labels
bug Something isn't working requires triage Requires triaging

Comments

@vvaibhavv11
Copy link

Issue description

after package the node-llama-cpp with electron it gives the error

Expected Behavior

expected behavior is that it should run but it does not run

Actual Behavior

actual dehavior is that it gives the following error when build for linux appimage

A JavaScript error occurred in the main process
Uncaught Exception:
TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier "#ansi-styles" is not defined imported from /tmp/.mount_ai-locIrAA9V/resources/app.asar/node_modules/node-llama-cpp/node_modules/chalk/source/index.js
    at importNotDefined (node:internal/modules/esm/resolve:305:10)
    at packageImportsResolve (node:internal/modules/esm/resolve:755:9)
    at moduleResolve (node:internal/modules/esm/resolve:854:16)
    at defaultResolve (node:internal/modules/esm/resolve:994:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:685:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:634:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:617:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:273:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:135:49)

Steps to reproduce

just clone the project and run pnpm dist:linux

https://github.com/vvaibhavv11/AI_local_electron.git

My Environment

Component Details
OS EndeavourOS (x64)
Node.js 23.9.0 (x64)
TypeScript 5.7.3
node-llama-cpp 3.6.0
Vulkan Available
Vulkan Device Intel(R) UHD Graphics (ICL GT1)
Vulkan VRAM Usage 0% used (0B/7.68GB)
Vulkan Free VRAM 100% free (7.68GB/7.68GB)
CPU Model Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
Math Cores 4
Used RAM 25.31% (3.89GB/15.37GB)
Free RAM 74.68% (11.47GB/15.37GB)
Used Swap 0% (0B/16.9GB)
Max Swap Size 16.9GB
mmap Support Supported

Additional Context

No response

Relevant Features Used

  • Metal support
  • CUDA support
  • Vulkan support
  • Grammar
  • Function calling

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time, but I can support (using donations) development.

@vvaibhavv11 vvaibhavv11 added bug Something isn't working requires triage Requires triaging labels Mar 18, 2025
@giladgd
Copy link
Contributor

giladgd commented Mar 19, 2025

@vvaibhavv11 I'm not sure what's wrong in your project configurations, but it's definitely related to Electron and not specific to node-llama-cpp.
I recommend you to scaffold a new node-llama-cpp Electron project and base your project on top of it using this command:

npm create node-llama-cpp@latest -- --template electron-typescript-react

Let me know if you encounter any issues with the scaffolded project.

@vvaibhavv11
Copy link
Author

well i found that the problem might be with electron or electron-builder most likely be with electron-builder because it gives error in production and the main error is when any dependency use the packages import like this

  "imports": {
    "#crypto": {
      "node": "./lib/crypto-node.js",
      "default": "./lib/crypto-native.js"
    }

it gives error after the build and i am gonna close it thank you for time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires triage Requires triaging
Projects
None yet
Development

No branches or pull requests

2 participants