ykhli/local-ai-stack

Failed to compile error when sending the first message

jean1190 opened this issue · 1 comments

Hello and thank you for this wonderful repo.

I followed every step, had to install "onnwruntime-node" manually because it was missing after using npm install, and still got this error after launching the server (without errors). I don't know how to solve. Thank you for the help.

I tried to install node-loader, but that didn't help.

(./node_modules/@xenova/transformers/node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/onnxruntime_binding.node Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders (Source code omitted for this binary file))

Here are the steps to solve this issue:

  1. Add this to config.next.js
    webpack: (config, { isServer }) => { if (isServer) { config.externals = ['@xenova/transformers/node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/onnxruntime_binding.node', ...config.externals]; config.module.rules.push({ test: /\.node$/, use: 'node-loader', }); } return config; },

  2. Install a previous version of Sharp module:
    npm uninstall sharp npm install sharp@0.32.6
    It resolved the issue for me at least.