Hello everyone,
I’m currently developing a dapp using parcel and IPFS, but I still can’t connect it to the IPFS daemon.
The goal, at the moment, is to create a simple web page where the user can upload a file which will be stored on IPFS. The problematic part of the code is the following:
import IpfsApi from “ipfs-api”;
import Ipfs from “ipfs”;
In order to connect to the ipfs daemon running on my machine I’ve already tried:
-
const ipfsClient = require(‘ipfs-http-client’);
const ipfs=ipfsClient(‘http://localhost:5001’); -
let ipfs=IpfsApi(‘localhost’, 5001);
Unfortunately none of them worked.
The error message I’m getting in both cases is the following one:
Uncaught TypeError: Cannot read properties of undefined (reading ‘TYPED_ARRAY_SUPPORT’)
at Object.parcelRequire…/…/…/AppData/Roaming/npm/node_modules/parcel-bundler/node_modules/buffer/index.js.base64-js (index.js:43)
at newRequire (app.c328ef1a.js:47)
at localRequire (app.c328ef1a.js:53)
at Object.parcelRequire…/node_modules/ipfs-api/src/index.js.multiaddr (load-commands.js:87)
at newRequire (app.c328ef1a.js:47)
at localRequire (app.c328ef1a.js:53)
at Object.parcelRequire.app.js.regenerator-runtime (app.js:6)
at newRequire (app.c328ef1a.js:47)
at app.c328ef1a.js:81
at app.c328ef1a.js:120
Moreover, if I don’t include regeneratorRuntime at the top of the .js file, I get the following error message:
core.js:70 Uncaught ReferenceError: regeneratorRuntime is not defined
at core.js:70
at Object.parcelRequire…/node_modules/ipfs-http-client/cjs/src/lib/core.js.multiaddr (core.js:70)
at newRequire (app.c328ef1a.js:47)
at localRequire (app.c328ef1a.js:53)
at Object.parcelRequire…/node_modules/ipfs-http-client/cjs/src/lib/configure.js…/core.js (configure.js:5)
at newRequire (app.c328ef1a.js:47)
at localRequire (app.c328ef1a.js:53)
at Object.parcelRequire…/node_modules/ipfs-http-client/cjs/src/bitswap/wantlist.js.multiformats/cid (wantlist.js:6)
at newRequire (app.c328ef1a.js:47)
at localRequire (app.c328ef1a.js:53)
(anonymous) @ core.js:70
parcelRequire…/node_modules/ipfs-http-client/cjs/src/lib/core.js.multiaddr @ core.js:70
newRequire @ app.c328ef1a.js:47
localRequire @ app.c328ef1a.js:53
parcelRequire…/node_modules/ipfs-http-client/cjs/src/lib/configure.js…/core.js @ configure.js:5
newRequire @ app.c328ef1a.js:47
localRequire @ app.c328ef1a.js:53
parcelRequire…/node_modules/ipfs-http-client/cjs/src/bitswap/wantlist.js.multiformats/cid @ wantlist.js:6
newRequire @ app.c328ef1a.js:47
localRequire @ app.c328ef1a.js:53
parcelRequire…/node_modules/ipfs-http-client/cjs/src/bitswap/index.js…/wantlist.js @ index.js:5
newRequire @ app.c328ef1a.js:47
localRequire @ app.c328ef1a.js:53
parcelRequire…/node_modules/ipfs-http-client/cjs/src/index.js.ipfs-core-utils/multibases @ index.js:12
newRequire @ app.c328ef1a.js:47
localRequire @ app.c328ef1a.js:53
parcelRequire.app.js.ipfs-http-client @ app.js:9
newRequire @ app.c328ef1a.js:47
(anonymous) @ app.c328ef1a.js:81
(anonymous) @ app.c328ef1a.js:120
Could someone help me with this? The tutorial I was following to create this file is: Getting started with IPFS using Javascript and js-ipfs :: Harun Đulić — Founder & Software Engineer
For any other additional information please ask, thank you all in advance