-
Notifications
You must be signed in to change notification settings - Fork 446
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
Getting started javascript example from the docs does not work with nodejs #1620
Comments
You cannot use |
the issue seems compatibility related , the library does not work with 16.0.0 however started working with node version 18 that also only 18.0.0, so it would be nice to share with the first time users the exact version on node and npm when we test a particular release |
Bringing this back up rather than creating a new ticket. The issue is that the example documentation is errant how it's currently written: https://github.com/libp2p/js-libp2p/tree/master/examples/pubsub 1.js uses import, but the README shows the example being run as such:
I'm on Node.js v19.8.1. |
I think I'm seeing the same issue: |
getting exception as below when trying to run the example in nodejs setup , i am a new to libp2p world , any help is appreciated
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in/samplenode/node-hello-master/node_modules/@libp2p/mdns/package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
at packageExportsResolve (node:internal/modules/esm/resolve:693:7)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/samplenode/node-hello-master/index.js:2:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in/samplenode/node-hello-master/node_modules/libp2p/package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
at packageExportsResolve (node:internal/modules/esm/resolve:693:7)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/samplenode/node-hello-master/index.js:1:22) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
class used
app.txt
/samplenode/node-hello-master$ node -v
v16.15.1
samplenode/node-hello-master$ npm -v
9.5.1
package,.json
{
"name": "node-hello",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/johnpapa/node-hello.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/johnpapa/node-hello/issues"
},
"homepage": "https://github.com/johnpapa/node-hello#readme",
"dependencies": {
"@chainsafe/libp2p-noise": "^11.0.1",
"@libp2p/mdns": "^7.0.0",
"@libp2p/mplex": "^7.1.1",
"@libp2p/tcp": "^6.1.2",
"@libp2p/websockets": "^5.0.4",
"libp2p": "^0.42.2"
}
}
The text was updated successfully, but these errors were encountered: