I am really desperate, because I want to instantiate a local node in my webapp created with reactjs. I tried installing ipfs-core using this documentation: ipfs-core - npm which didnt work for me. React was not able to find the package.
Then I installed the “whole” ipfs package, which also didnt work (same error as above).
I am able to use ipfs-http-client, but it doesnt let me create a local node:
var ipfsHttpClient = require('ipfs-http-client');
var ipfs = ipfsHttpClient.create();
ipfs.add("Test");
throws
POST http://localhost:3001/api/v0/add?stream-channels=true&progress=false 404 (Not Found)
I know i can us a public gateway as parameter inside the create() function and everything works fine. But I dont want to rely on public gateways in my app. I thought I found an answer in this post: How to upload file to IPFS with only front-end but they also used ipfs-core.
My question: does anyone know how to create a local node in browser to store ipfs files using ipfs-http-client. Maybe someone also knows why using “ipfs-core” and “ipfs” package didnt work. Thanks for your help
EDIT:
I want users to be able to have the node in the browser but not IPFS installed.
Which version of ipfs-core are you using? Because when I try to isntall ipfs-core via npm install ipfs-core@latest no module with the name ipfs-core is downloaded (only some other IPFS folders). Therefore I can’t import it via “import” statement.
Thanks for your help, I got it to work!
Do you have experience with LockExistsError?
I have set IPFS as a globale object and put it inside useEffect so it is called only once: