I have had problems in the last days, to run the OrbitDB examples.
The problem that appears in the web browser is the following:
Uncaught ReferenceError: Ipfs is not defined
Specifically in the file "example.js"
// Create IPFS instance const ipfs = new Ipfs({ repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', start: true, preload: { enabled: false }, EXPERIMENTAL: { pubsub: true, }, config: { Addresses: { Swarm: [ // Use IPFS dev signal server // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star', // Use local signal server // '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', ] }, } })
You can see the problem in the following image:
The problem is due to the fact that there is a new version of the IPFS library, therefore the way to create the IPFS class instance has changed.
Solution:
To solve the problem, the example has been modified to be able to run the program correctly in the browser.
To solve the problem it is necessary to follow the following steps:
1)Modify the file "browser.html", with the dependencies in the correct path.
Before:
After:
2) The file "example.js" should be modified, with the new form of the latest version of IPFS.
Before:
After:
Once the previous steps have been carried out, we can now correctly run the example with the latest version of IPFS.
I have had problems in the last days, to run the OrbitDB examples.
The problem that appears in the web browser is the following:
Uncaught ReferenceError: Ipfs is not defined
Specifically in the file "example.js"
// Create IPFS instance const ipfs = new Ipfs({ repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', start: true, preload: { enabled: false }, EXPERIMENTAL: { pubsub: true, }, config: { Addresses: { Swarm: [ // Use IPFS dev signal server // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star', // Use local signal server // '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', ] }, } })
You can see the problem in the following image:
The problem is due to the fact that there is a new version of the IPFS library, therefore the way to create the IPFS class instance has changed.
Solution:
To solve the problem, the example has been modified to be able to run the program correctly in the browser.
To solve the problem it is necessary to follow the following steps: 1)Modify the file "browser.html", with the dependencies in the correct path. Before:
After:
2) The file "example.js" should be modified, with the new form of the latest version of IPFS.
Before:
After:
Once the previous steps have been carried out, we can now correctly run the example with the latest version of IPFS.
Have a nice day :)