axios icon indicating copy to clipboard operation
axios copied to clipboard

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/helpers/buildURL.js' is not defined by "exports"

Open mahnunchik opened this issue 2 years ago • 3 comments

Describe the bug

After upgrading from version 0.27.2 to 1.1.3 I've faced with the error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/helpers/buildURL.js' is not defined by "exports" in /test/node_modules/axios/package.json imported from /test/request.js

To Reproduce

  1. Install axios version 1+
  2. Try to import any helper

Code snippet

import buildURL from 'axios/lib/helpers/buildURL.js';
import combineURLs from 'axios/lib/helpers/combineURLs.js';

Expected behavior

Helpers imported as it was in pre 1.0 version.

Axios Version

1.1.3

Adapter Version

Browser

Browser Version

Node.js Version

v16.16.0

OS

macOS

Additional Library Versions

Project is in ESM module format `"type": "module",`.

Additional context/Screenshots

No response

mahnunchik avatar Oct 26 '22 12:10 mahnunchik

Related issues:

  • https://github.com/axios/axios/issues/5183
  • https://github.com/axios/axios/issues/5072

mahnunchik avatar Oct 26 '22 12:10 mahnunchik

Can we have an update please?

rkanumola avatar Jan 31 '24 11:01 rkanumola

Issue still occurs, can someone give any updates on this ?

I was checking maybe the problem is with NodeJS version, or with Next version or other libraries but it seems like smth happen here image

or maybe in other module that uses buildURL function.

Would be great to know whether there are at least some advices for that, as since 0.28.1 here we have a problem from Snyk:

All of those are fixed in 1.6.0, 1.6.3 and 1.6.4, but with 1.6.4 or later same issue exists:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/helpers/buildURL' is not defined by "exports" in /Users/romanblyztsiv/Documents/departmentstore-edge/node_modules/axios/package.json at new NodeError (node:internal/errors:405:5) at exportsNotFound (node:internal/modules/esm/resolve:261:10) at packageExportsResolve (node:internal/modules/esm/resolve:591:9) at resolveExports (node:internal/modules/cjs/loader:547:36) at Function.Module._findPath (node:internal/modules/cjs/loader:621:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1034:27) at Function.call (/Users/romanblyztsiv/Documents/departmentstore-edge/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30) at /Users/romanblyztsiv/Documents/departmentstore-edge/node_modules/next/src/server/require-hook.ts:50:34 at Function.Module._load (node:internal/modules/cjs/loader:901:27) at Module.require (node:internal/modules/cjs/loader:1115:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }

ms4ever7 avatar Apr 25 '24 11:04 ms4ever7