Skip to content

Build failed with vite build "promises" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs". #189

Open
@ejgutierrez74

Description

I found this error: in vite in dev works fine, but when i make a run build to run a vite build i got:

Seems its an error in ollama-js side as written in Vite documentation: https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility

`vite v6.0.6 building for production...
[plugin:vite:resolve] [plugin vite:resolve] Module "fs" has been externalized for browser compatibility, imported by "/home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "os" has been externalized for browser compatibility, imported by "/home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
✓ 79 modules transformed.
x Build failed in 654ms
error during build:
node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs (2:13): "promises" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs".
file: /home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/ollama@0.5.11/node_modules/ollama/dist/index.mjs:2:13

1: import { O as Ollama$1, h as head, p as post } from './shared/ollama.cddbc85b.mjs';
2: import fs, { promises, createReadStream } from 'fs';
                ^
3: import { resolve, join, dirname } from 'path';
4: import { createHash } from 'crypto';

    at getRollupError (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
    at error (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
    at Module.error (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:15655:16)
    at Module.traceVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:16104:29)
    at ModuleScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:13887:39)
    at ChildScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:5306:38)
    at ClassBodyScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:5306:38)
    at ChildScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:5306:38)
    at ChildScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:5306:38)
    at FunctionScope.findVariable (file:///home/eduardo/WebstormProjects/MeuPacman/node_modules/.pnpm/rollup@4.29.1/node_modules/rollup/dist/es/shared/node-entry.js:5306:38)
 ELIFECYCLE  Command failed with exit code 1.
`

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions