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

Ollama 0.5.7 introduce a BREAKING CHANAGE for browser usage #132

Closed
arvinxx opened this issue Aug 13, 2024 · 1 comment
Closed

Ollama 0.5.7 introduce a BREAKING CHANAGE for browser usage #132

arvinxx opened this issue Aug 13, 2024 · 1 comment

Comments

@arvinxx
Copy link

arvinxx commented Aug 13, 2024

We use ollama-js in browser and edge runtime. But 0.5.7 seems intro the node into these cases, which cause the vercel build error:

image

here is the error stack:

node:fs
Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
    at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401757
    at Hook.eval [as callAsync] (eval at create (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:13:28858), <anonymous>:6:1)
    at Object.processResource (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401682)
    at processResource (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)
    at iteratePitchingLoaders (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)
    at runLoaders (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)
    at NormalModule._doBuild (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401544)
    at NormalModule.build (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:403572)
    at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:82055
    at NormalModule.needBuild (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:407670)
Import trace for requested module:
node:fs
./node_modules/fetch-blob/from.js
./node_modules/node-fetch/src/index.js
./node_modules/ollama/dist/shared/ollama.7d273fc8.mjs
./node_modules/ollama/dist/browser.mjs
./src/libs/agent-runtime/ollama/index.ts
./src/libs/agent-runtime/index.ts
./src/app/api/chat/models/[provider]/route.ts

here is the reproduction repo and branch: https://github.com/lobehub/lobe-chat/tree/reproduction/ollama-0.5.7

pnpm i

pnpm run build

I think this issue is introduced by #125 , I suggest to revert this change.

@jmorganca
Copy link
Member

This should be fixed in https://github.com/ollama/ollama-js/releases/tag/v0.5.8 while a longer term solution is found. Thanks for the issue!

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