Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in @libp2p/tcp/package.json
stephane-segning opened this issue · comments
Hello all. Thank you for this boilerplate. I'm writing here because of a technical issue when adding a dependency.
Prerequisites
- Using npm
- Using pnpm
- Using an up-to-date
main
branch - Using latest version of devtools. Check the docs for how to update
- Tried solutions mentioned in #400
- For issue in production release, add devtools output of
DEBUG_PROD=true npm run build && npm start
Expected Behavior
The project should have started without issue
Current Behavior
The app just crashes with this error:
App threw an error during load
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/sse/Developer/tekum-call/node_modules/@libp2p/tcp/package.json
at new NodeError (node:internal/errors:399:5)
at exportsNotFound (node:internal/modules/esm/resolve:361:10)
at packageExportsResolve (node:internal/modules/esm/resolve:641:13)
at resolveExports (node:internal/modules/cjs/loader:574:36)
at Function._findPath (node:internal/modules/cjs/loader:643:31)
at node:internal/modules/cjs/loader:1070:27
at Function.<anonymous> (node:electron/js2c/browser_init:2:117576)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/sse/Developer/tekum-call/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (/Users/sse/Developer/tekum-call/node_modules/.pnpm/runtime-required@1.1.0/node_modules/runtime-required/runtime-required.js:28:44)
at Module.require (node:internal/modules/cjs/loader:1150:19)
[electronmon] uncaught exception occured
[electronmon] waiting for any change to restart the app
Steps to Reproduce
I'm working on a public repo.
To have an example of file, we have https://github.com/stephane-segning/vichiz/blob/main/src/main/dpm.ts.
-
Create basic project
-
Add
@libp2p/tcp
,@libp2p/noise
orlibp2p
to it -
Try using it in a way. More examples at https://github.com/libp2p/js-libp2p/tree/master/examples.
-
Run the app
Possible Solution (Not obligatory)
Context
A dependency not working makes it difficult to use the rest of the app.
My changes on the config side are just about tailwindcss.
Your Environment
- Node version: v18.16.0
- electron-react-boilerplate version or branch: 4.6.0
- Operating System and version: MacOS Ventura 13.5.1
- Link to your project: https://github.com/stephane-segning/vichiz/tree/main