2

I have installed some js-libp2p's packages on my Ethereum Blockchain-ipfs project and I wrote some codes like below.

const TCP = require('libp2p-tcp');
const MulticastDNS = require('libp2p-mdns');
const WS = require('libp2p-websockets');
const KadDHT = require('libp2p-kad-dht')
const mplex = require('libp2p-mplex');
const secio = require('libp2p-secio');
const libp2p = require('libp2p');

But the multicast-dns ,libp2p and libp2p-kad-dht module is showing some error.

ERROR in ./~/libp2p/src/index.js

Module parse failed: /home/toshiba/Documents/sul/ipfs/CannesNew Full Codejan17/SportsFull CodeTESTRpc12may/SportsFull Code1april/node_modules/libp2p/src/index.js Unexpected token (120:8)

You may need an appropriate loader to handle this file type.

| this._dht = new DHT(this._switch, { | datastore: this.datastore, | ...this._config.dht | }) | }

@ ./app/backend/app.js 62:15-32

@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/backend/app.js

Environment

Npm version: 6.4.1

Node version: 8.12.0

Os:Ubuntu 18.04

Anyone please help me to resolve this issue.

I already imported this js-libp2p packages in my meanstack application with normal node and npm and it works well.But when I am importing this packages in blockchain application, it is showing the above error.

My current webpack version is 2.2.1

My webpack.config.js code is shown below,

...
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
],
loaders: [
{ test: /\.json$/, use: 'json-loader' },
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: ['transform-runtime']
}
}
]
},
...
  • The package.json says it requires node >= 6.0 but their .travis.yml file says node_js = 10. I'd guess you need at least node 10, but probably it is better if you create an issue in their github repo so they can document it properly. – Ismael Jun 24 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.