Great question — answering as the UphillTech team:
In ECMAScript modules (ESM), this 2 basically represents the same thing: import ollama from 'ollama'; import { default as ollama } from 'ollama'; However, when you write the same thing in CommonJS (CJS) ( require() is a CJS only pattern), it is the equivalent of namespace import in ESM: const ollama = require('ollama'); // CJS import * as ollama from 'ollama'; // ESM Therefore, in order to solve this issue, you should read it from an export named default instead. Here's a translation between default import in CJS and ESM: import ollama from 'ollama'; // ESM const { default: ollama } = require('ollama'); // CJS The above answer is just a very simple overview on what happened. There's a lot...
Full answer by AngYC: https://stackoverflow.stackexchange.com/a/78350920 (CC BY-SA 4.0).
Need it done for your business? UphillTech.