Skip to content

ERR_PACKAGE_PATH_NOT_EXPORTED for shelljs/plugin and shelljs/global #1195

@nfischer

Description

@nfischer

I noticed that plugins cannot import either require(shelljs/global) or require(shelljs/plugin). I'm testing this from the shelljs-plugin-open repository:

$ npm run test

node:internal/modules/cjs/loader:591
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './plugin' is not defined by "exports" in [PATH REDACTED]/shelljs-plugin-open/node_modules/shelljs/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:366:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
    at resolveExports (node:internal/modules/cjs/loader:584:36)
    at Module._findPath (node:internal/modules/cjs/loader:658:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1120:27)
    at Module._load (node:internal/modules/cjs/loader:975:27)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> ([PATH REDACTED]/shelljs-plugin-open/index.js:2:14)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> ([PATH REDACTED]/shelljs-plugin-open/test/test.js:20:18)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at [PATH REDACTED]/shelljs-plugin-open/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles ([PATH REDACTED]/shelljs-plugin-open/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run ([PATH REDACTED]/shelljs-plugin-open/node_modules/mocha/lib/mocha.js:576:10)
    at Object.<anonymous> ([PATH REDACTED]/shelljs-plugin-open/node_modules/mocha/bin/_mocha:637:18)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v18.19.1

This error is for shelljs/plugin, however if I fix the bug then I get the same error for shelljs/global.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug/defect, or a fix for such a problemhigh priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions