Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

ipfs initialization takes forever #2768

Closed
emclab opened this issue Feb 11, 2020 · 6 comments
Closed

ipfs initialization takes forever #2768

emclab opened this issue Feb 11, 2020 · 6 comments

Comments

@emclab
Copy link

emclab commented Feb 11, 2020

  • Version:0.40.0
  • Platform:macOS Catalina
  • Subsystem:nodes-mobile-react-native 0.5.0. Nodejs: 10.17.0, React Native 0.61.5

Type:

I have the following code to init ipfs (0.40.0):

// Rename this sample file to main.js to use on your project.
// The main.js file will be overwritten in updates/reinstalls.

var rn_bridge = require(‘rn-bridge’);

// Echo every message received from react-native.
rn_bridge.channel.on(‘message’, async (msg) => {
switch (msg) {
case “save”:
break;
case “retrieve”:
break;
default:
break;
};
rn_bridge.channel.send(“From node in main.js”)
const IPFS = require(‘ifps’);
const ipfs_node = await IPFS.create();
rn_bridge.channel.send("from Node version " + ipfs_node.version);

} );

// Inform react-native node is initialized.
rn_bridge.channel.send(“Node was initialized.”);

The problem is that I never seen rn_b
ridge.channel.send("from Node version " + ipfs_node.version); get executed. Why ipfs initialization takes so long? Or my code isn’t right How to check if the ipfs is initialized successfully?

@achingbrain
Copy link
Member

IPFS uses the debug module to do logging - if you can get it to output the logs and paste them here it'd be helpful - either set DEBUG=ipfs* as an environmental variable for node-type environments or localStorage.debug = 'ipfs*' for browser ones.

@emclab
Copy link
Author

emclab commented Feb 11, 2020

A little bit more info. Type jsipfs in command line did generate responding output. The ipfs is installed globally and I can't make local installation work. Also it is on MacOS catalina.

Will post the log.

@emclab
Copy link
Author

emclab commented Feb 11, 2020

I have hard time to get a debug log. But I did insert a message alert after const IPFS = require('ipfs') and didn't get any message. It seems to me that the require('ipfs') did not work. Here is the output of jsipfs in command line:

  zhouyiyundeMacBook-Air:ipat_test zhouyiyun$ jsipfs

Not enough non-option arguments: got 0, need at least 1
jsipfs

Commands:
jsipfs add [file...] Add a file to IPFS using the UnixFS
data format
jsipfs bitswap Interact with the bitswap agent.
jsipfs block Manipulate raw IPFS blocks.
jsipfs bootstrap Show or edit the list of bootstrap
peers.
jsipfs cat Fetch and cat an IPFS path referencing
a file
jsipfs cid Convert, format and discover
properties of CIDs.
jsipfs commands List all available commands
jsipfs config [value] Get and set IPFS config values
jsipfs daemon Start a long-running daemon process
jsipfs dag Interact with ipld dag objects.
jsipfs dht Issue commands directly through the
DHT.
jsipfs dns Resolve DNS links
jsipfs file Interact with IPFS objects
representing Unix filesystems.
jsipfs get Fetch a file or directory with files
references from an IPFS Path
jsipfs id Shows IPFS Node ID info
jsipfs init [default-config] [options] Initialize a local IPFS node

                                      If you are going to run IPFS in a
                                      server environment, you may want to
                                      initialize it using the 'server'
                                      profile.

                                      For the list of available profiles run
                                      `jsipfs config profile ls`

jsipfs key Manage your keys
jsipfs ls List files for the given directory
jsipfs name Publish and resolve IPNS names.
jsipfs object Interact with ipfs objects.
jsipfs pin Pin and unpin objects to local
storage.
jsipfs ping Measure the latency of a connection
jsipfs pubsub pubsub commands
jsipfs refs-local List all local references.
jsipfs refs [keys..] List links (references) from an object
jsipfs repo Manipulate the IPFS repo.
jsipfs resolve Resolve the value of names to IPFS
jsipfs shutdown Shut down the ipfs daemon
jsipfs stats Query IPFS statistics.
jsipfs swarm Swarm inspection tool.
jsipfs version Shows IPFS version information
jsipfs completion generate completion script
jsipfs files Operations over mfs files (ls, mkdir,
rm, etc)

@emclab
Copy link
Author

emclab commented Feb 11, 2020

also require.resolve('ipfs') didn't throw error and any output. Just nothing and hung.

@emclab
Copy link
Author

emclab commented Feb 11, 2020

Based on my debug, I think the ipfs somehow is not properly installed but don't know why. The ipfs was installed globally without any error. But local installation of 'ipfs` failed the launch build (error about gc-stats@1.4.0)

@achingbrain
Copy link
Member

React Native is not (yet) a supported platform for running js-IPFS - we're working on adding support over at #2813

Once that issue is resolved we'll be in a better position to debug and fix problems with IPFS running on RN, so if this problem still occurs after that is complete please re-open this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants