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

[plugin-data-persistence]: ERR_PACKAGE_PATH_NOT_EXPORTED, Issue with package import #624

Open
KrishnaManohar1997 opened this issue Feb 6, 2024 · 4 comments

Comments

@KrishnaManohar1997
Copy link

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
image

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

  1. Installed Orama [Worked fine] (latest version)
  2. Installed plugin-data-persistence latest version
  3. Imported {persistToFile} package from import { restoreFromFile } from '@orama/plugin-data-persistence/dist/server';
  4. Executed the node --loader ts-node/esm driver.ts
  5. 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/orama@2.0.3
Orama/plugin-data-persistence: @orama/plugin-data-persistence@2.0.3 [I've tried using old versions of the Plugin package]

Affected areas

Initialization

Additional context

No response

@came
Copy link

came commented Feb 29, 2024

Three weeks no response :/ I have the same issue.

@micheleriva
Copy link
Member

Hi there, sorry for such a late reply. We're investigating

@micheleriva
Copy link
Member

micheleriva commented Mar 1, 2024

Quick question @came, @KrishnaManohar1997, are you using this in a CJS module or in an ESM one?

@djibe
Copy link

djibe commented Apr 22, 2024

Import is import { persist } from '@orama/plugin-data-persistence' isn't it ?

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

4 participants