I'm learning ipfs js based on the tutorial, but while I'm following I'm having trouble typing node main.js in the terminal like this:
/Users/username/Documents/coding/ipfs-test/node_modules/lock-me/src/unix.js:9
(cb) => fs.stat(name, (err, stats) => {
^
TypeError: fs.stat is not a function
at waterfall (/Users/username/Documents/coding/ipfs-test/node_modules/lock-me/src/unix.js:9:16)
at nextTask (/Users/username/Documents/coding/ipfs-test/node_modules/async/waterfall.js:16:14)
at exports.default (/Users/username/Documents/coding/ipfs-test/node_modules/async/waterfall.js:26:5)
at unixLock (/Users/username/Documents/coding/ipfs-test/node_modules/lock-me/src/unix.js:8:3)
at lock (/Users/username/Documents/coding/ipfs-test/node_modules/lock-me/src/index.js:53:5)
at Object.exports.lock (/Users/username/Documents/coding/ipfs-test/node_modules/ipfs-repo/src/lock.js:23:3)
at IpfsRepo._openLock (/Users/username/Documents/coding/ipfs-test/node_modules/ipfs-repo/src/index.js:168:18)
at waterfall (/Users/username/Documents/coding/ipfs-test/node_modules/ipfs-repo/src/index.js:96:20)
This is code written in main.js:
const IPFS = require('ipfs');
console.log("Imported IPFS");
const mynode = new IPFS();
console.log("Starting Server");
mynode.on('ready', async () => {
console.log("Server Started");
const version = await mynode.version();
console.log(version.version);
});
Information: I'm using node js version 8.13.0, The IPFS JS I'm using is version 0.32.3, With OS MacOS Bigsur 11.4
Is there a solution to this problem? Thanks ^^
I'm not sure what tutorial you're following, but here's a minimal example of getting your code to run using js-ipfs 0.55.3: