orama
orama copied to clipboard
[plugin-data-persistence]: ERR_PACKAGE_PATH_NOT_EXPORTED, Issue with package import
Describe the bug
When I'm trying to make use of plugin-data-persistence
import { persistToFile } from '@orama/plugin-data-persistence';
I immediately face an error
throw new Error(METHOD_MOVED('persistToFile'));
^
Error: Function persistToFile has been moved to the "/server" module.
Import it via "import { persistToFile } from 'orama/plugin-data-persistence/server'".
I then immediately updated the import to import { persistToFile } from 'orama/plugin-data-persistence/server'
However facing the following import issue
I have then managed to remove the import error by changing the import path to
import { persistToFile } from '@orama/plugin-data-persistence/dist/server';
This is leading to the following error
Error: ERR_PACKAGE_PATH_NOT_EXPORTED /Users/DevUser/myCode/nlp/node_modules/@orama/plugin-data-persistence/ ./dist/server /Users/DevUser/myCode/nlp/orama/databaseWrapper.ts
at throwExportsNotFound ( /Users/DevUser/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:380:9)
at packageExportsResolve ( /Users/DevUser/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:605:3)
at packageResolve ( /Users/DevUser/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:746:14)
at moduleResolve ( /Users/DevUser/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:798:18)
at Object.defaultResolve ( /Users/DevUser/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
I'm using the following command to execute my code
node --trace-warnings --loader ts-node/esm driver.ts
To Reproduce
- Installed Orama [Worked fine] (latest version)
- Installed plugin-data-persistence latest version
- Imported {persistToFile} package from
import { restoreFromFile } from '@orama/plugin-data-persistence/dist/server';
- Executed the
node --loader ts-node/esm driver.ts
- Faced with the error
Error: ERR_PACKAGE_PATH_NOT_EXPORTE
Expected behavior
I expected the import to work normally, which is failing with importing the package component persistToFile
Environment Info
OS: MacOs Sonoma 14.1.2
Node: v21.5.0
Orama: @orama/[email protected]
Orama/plugin-data-persistence: @orama/[email protected] [I've tried using old versions of the Plugin package]
Affected areas
Initialization
Additional context
No response
Three weeks no response :/ I have the same issue.
Hi there, sorry for such a late reply. We're investigating
Quick question @came, @KrishnaManohar1997, are you using this in a CJS module or in an ESM one?
Import is import { persist } from '@orama/plugin-data-persistence'
isn't it ?