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

IONIC App on Device: MKDIR Issue #1677

Closed
humanely opened this issue Oct 29, 2018 · 4 comments
Closed

IONIC App on Device: MKDIR Issue #1677

humanely opened this issue Oct 29, 2018 · 4 comments

Comments

@humanely
Copy link

humanely commented Oct 29, 2018

  • Version: 0.33.0-rc.3
  • Platform: IOS IPhone X
  • Subsystem: Xcode 10

Type: Question

Severity: Medium

Description:

Installed platforms:
ios 4.5.5
Available platforms:
android ~7.1.1
browser ~5.0.1
osx ~4.0.1
windows ~6.0.0

Source Code of the IPFS repo in App

`

var http = require('http');
const PeerId = require('peer-id');
const PeerInfo = require('peer-info');
const multiaddr = require('multiaddr');
const tcpp = require('tcp-ping');
const cordova = require('cordova-bridge');
const IPFS = require('ipfs')
const Node = new IPFS()
`

I built a simple app to run relays on mobile. It works fine on simulator from Xcode 10. But it gives error of not able to create folder during init of IPFS.
What could be an ideal way to pre create this folder or some other ways to solve this?

2018-10-28 18:04:35.909461-0400 hdapp4[2879:511458] Apache Cordova native platform version 4.5.5 is starting.
2018-10-28 18:04:35.910139-0400 hdapp4[2879:511458] Multi-tasking -> Device: YES, App: YES
2018-10-28 18:04:35.923382-0400 hdapp4[2879:511458] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-10-28 18:04:36.039684-0400 hdapp4[2879:511458] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-10-28 18:04:36.039771-0400 hdapp4[2879:511458] Using Ionic WKWebView
2018-10-28 18:04:36.041256-0400 hdapp4[2879:511458] [CDVTimer][console] 0.321031ms
2018-10-28 18:04:36.041513-0400 hdapp4[2879:511458] [CDVTimer][handleopenurl] 0.186086ms
2018-10-28 18:04:36.043334-0400 hdapp4[2879:511458] [CDVTimer][intentandnavigationfilter] 1.787066ms
2018-10-28 18:04:36.043422-0400 hdapp4[2879:511458] [CDVTimer][gesturehandler] 0.054002ms
2018-10-28 18:04:36.047073-0400 hdapp4[2879:511458] [CDVTimer][statusbar] 3.602028ms
2018-10-28 18:04:36.050807-0400 hdapp4[2879:511458] [CDVTimer][splashscreen] 3.695011ms
2018-10-28 18:04:36.050919-0400 hdapp4[2879:511458] CDVIonicKeyboard: resize mode 1
2018-10-28 18:04:36.051956-0400 hdapp4[2879:511458] [CDVTimer][keyboard] 1.062036ms
2018-10-28 18:04:36.052061-0400 hdapp4[2879:511458] -[CDVNodeJS pluginInitialize]
2018-10-28 18:04:36.052347-0400 hdapp4[2879:511458] [CDVTimer][nodejs] 0.326037ms
2018-10-28 18:04:36.052421-0400 hdapp4[2879:511458] [CDVTimer][TotalPluginStartup] 11.587977ms
2018-10-28 18:04:36.135656-0400 hdapp4[2879:511458] -[CDVNodeJS onReset]
2018-10-28 18:04:36.935722-0400 hdapp4[2879:511458] -[CDVNodeJS setAllChannelsListener:]
2018-10-28 18:04:36.945259-0400 hdapp4[2879:511458] Ionic Native: deviceready event fired after 560 ms
2018-10-28 18:04:36.951385-0400 hdapp4[2879:511458] -[CDVNodeJS startEngine:]
/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/mkdirp/index.js:90
throw err0;
^

Error: EPERM: operation not permitted, mkdir '/private/var/mobile/Containers/Data/Application/1F3093D2-11AF-4457-8E01-095A8E17DA0E/.jsipfs'
at sync (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/mkdirp/index.js:90:21)
at FsDatastore.prototype._create (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/datastore-fs/src/index.js:87:5)
at FsDatastore.prototype._openOrCreate (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/datastore-fs/src/index.js:101:9)
at FsDatastore (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/datastore-fs/src/index.js:54:7)
at createBackend (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/ipfs-repo/src/backends.js:6:3)
at IpfsRepo (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/ipfs-repo/src/index.js:53:5)
at module.exports (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/ipfs/src/core/runtime/repo-nodejs.js:10:3)
at IPFS (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/node_modules/ipfs/src/core/index.js:60:7)
at Anonymous function (/private/var/containers/Bundle/Application/C21DE842-2939-4DA1-81D4-37A5D1EDB7C6/hdapp4.app/www/nodejs-project/main.js:10:1)
at Module.prototype._compile (module.js:624:5)

@alanshaw
Copy link
Member

IPFS expects to be run in a Node.js environment so it's trying to write to the OS home directory but that's not possible from a webview, my guess is that with cordova you'd be better off using the browser build https://github.com/ipfs/js-ipfs#use-in-the-browser

Running js-ipfs on mobile is currently untested but planned for the future. Please feedback with how you get on.

@alanshaw
Copy link
Member

alanshaw commented Nov 1, 2018

Lets track cordova support here #834

@alanshaw alanshaw closed this as completed Nov 1, 2018
@alanshaw
Copy link
Member

alanshaw commented Nov 1, 2018

...and ionic here #802

@Juanperezc
Copy link

Juanperezc commented Dec 3, 2018

Try running the js-ipfs node on ios (ionic) and everything is fine until now

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

3 participants