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

ERR_PACKAGE_PATH_NOT_EXPORTED #3

Open
gionaico opened this issue Sep 21, 2022 · 1 comment
Open

ERR_PACKAGE_PATH_NOT_EXPORTED #3

gionaico opened this issue Sep 21, 2022 · 1 comment

Comments

@gionaico
Copy link

gionaico commented Sep 21, 2022

Versions

node 16.17.0
moleculer 0.14.23
minio 7.0.23

My service

const MIXIN_MINIO = require("moleculer-minio");
const MINIO_SVC = {
  name: "my_minio_svc",
  mixins: [MIXIN_MINIO],
  actions:{}
}

Error

 Failed to load service '/MY_LOCAL_PATH/minio.svc.ts' Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './src/errors' is not defined by "exports" in /node_modules/moleculer/package.json
at new NodeError (node:internal/errors:387:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:464:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:748:3)
    at resolveExports (node:internal/modules/cjs/loader:493:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:679:30)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'

Solution

If you change the way to import Errors from Molecuer you will resolve this problem.

    // Current import way
    const {MoleculerRetryableError} = require("moleculer/src/errors");
    // Correct way
       // Option 1
       const {MoleculerRetryableError} = require("moleculer").Errors;
       // Option 2
       const {Errors } = require("moleculer");  //Errors.MoleculerRetryableError     
@ImTheDeveloper
Copy link

Good catch - there is the same error in the moleculer-aws-s3 package too.

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