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

Error of Electron not supported on IOS when installing IPFS on MacOS #2774

Closed
emclab opened this issue Feb 12, 2020 · 8 comments
Closed

Error of Electron not supported on IOS when installing IPFS on MacOS #2774

emclab opened this issue Feb 12, 2020 · 8 comments

Comments

@emclab
Copy link

emclab commented Feb 12, 2020

  • Version:ipfs 0.40.0,
  • Platform: macOS Catalina
  • Subsystem: Node 12.16.0, nodes-mobile-react-native 0.5.0, React Native 0.61.5
  npm info build /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/edge-launcher

npm info lifecycle [email protected]preinstall: [email protected]
npm info linkStuff [email protected]
npm info lifecycle [email protected]
install: [email protected]
npm info lifecycle [email protected]postinstall: [email protected]
npm verb rebuild bundle /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ee-first
npm info build /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ee-first
npm info lifecycle [email protected]
preinstall: [email protected]
npm info linkStuff [email protected]
npm info lifecycle [email protected]install: [email protected]
npm info lifecycle [email protected]
postinstall: [email protected]
npm verb rebuild bundle /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ejs
npm info build /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ejs
npm info lifecycle [email protected]preinstall: [email protected]
npm info linkStuff [email protected]
npm info lifecycle [email protected]
install: [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]

[email protected] postinstall /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ejs
node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm verb lifecycle [email protected]postinstall: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]
postinstall: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ejs/node_modules/.bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/.bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/.bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Users/zhouyiyun/Documents/js/ipat_test1/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
npm verb lifecycle [email protected]postinstall: CWD: /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/ejs
npm verb rebuild bundle /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron
npm info build /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron
npm info lifecycle [email protected]
preinstall: [email protected]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins { electron: 'cli.js' },
npm verb linkBins '/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/.bin',
npm verb linkBins false
npm verb linkBins ]
npm verb rebuildBundles [ '@types' ]
npm info lifecycle [email protected]install: [email protected]
npm info lifecycle [email protected]
postinstall: [email protected]

[email protected] postinstall /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron
node install.js

/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron/install.js:68
throw new Error('Electron builds are not available on platform: ' + platform)
^

Error: Electron builds are not available on platform: ios
at getPlatformPath (/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron/install.js:68:13)
at Object. (/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron/install.js:22:20)
at Module._compile (internal/modules/cjs/loader.js:1157:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
at Module.load (internal/modules/cjs/loader.js:1001:32)
at Function.Module._load (internal/modules/cjs/loader.js:900:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
npm verb lifecycle [email protected]postinstall: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]
postinstall: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron/node_modules/.bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/.bin:/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/.bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Users/zhouyiyun/Documents/js/ipat_test1/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
npm verb lifecycle [email protected]postinstall: CWD: /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron
npm info lifecycle [email protected]
postinstall: Failed to exec postinstall script
npm verb stack Error: [email protected] postinstall: node install.js
npm verb stack Exit status 1
npm verb stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack at EventEmitter.emit (events.js:321:20)
npm verb stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:321:20)
npm verb stack at maybeClose (internal/child_process.js:1021:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
npm verb pkgid [email protected]
npm verb cwd /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project
npm verb Darwin 19.0.0
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "--verbose" "rebuild" "--build-from-source"
npm verb node v12.16.0
npm verb npm v6.13.4
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 10511ms

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhouyiyun/.npm/_logs/2020-02-12T20_42_39_670Z-debug.log
Command PhaseScriptExecution failed with a nonzero exit code

** BUILD FAILED **

The following build commands failed:
PhaseScriptExecution [CP-User]\ [NODEJS\ MOBILE]\ Build\ Native\ Modules /Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Intermediates.noindex/ipat_test1.build/Debug-iphonesimulator/ipat_test1.build/Script-821AE48DBADAD4819E69BEC8.sh

Severity:

Description:

Steps to reproduce the error:

@emclab
Copy link
Author

emclab commented Feb 12, 2020

The error happened when launch the app with npx react-native run-ios.

@achingbrain
Copy link
Member

/Users/zhouyiyun/Documents/js/ipat_test1/ios/build/ipat_test1/Build/Products/Debug-iphonesimulator/ipat_test1.app/nodejs-project/node_modules/ipfs/node_modules/electron/install.js:68
throw new Error('Electron builds are not available on platform: ' + platform)
^

Error: Electron builds are not available on platform: ios

Electron is indeed not available for iOS so this error makes sense. What makes less sense is why it's trying to install electron in the first place.

It could be related to ipfs/aegir#516 but it's hard to know for sure.

Similar to my request on one of your other issues can you please share a runnable example?

By this I mean please create a simple github repo that I can clone, run npm install in, then npx react-native run-ios and see the same error message. Then we will get to the bottom of this and, I suspect #2768 as well.

@achingbrain
Copy link
Member

I take it you're using npm to install your project dependencies?

If so, could you try removing your node_modules folder and installing with yarn?

@emclab
Copy link
Author

emclab commented Feb 13, 2020

I use yarn and tried npm as well. I repeated creation process a few times. The error here is after yarn add. The only code I have is:

 const IPFS = require('ipfs');

The execution of this line stuck. The issue should be related to module nodejs-mobile-react-native as well. But I don't know which module may have more into it.

@emclab
Copy link
Author

emclab commented Feb 13, 2020

yarn add ipfs has error about gc-stats but not electron. not sure why yarn and npm have different errors.

@achingbrain
Copy link
Member

Ok, can you please create and share a github repo with a small demo project in it that shows the problem along with instructions on how to replicate?

I'm not a react native expert so it would be really helpful.

If you like, you could PR a react-native example to https://github.com/ipfs/js-ipfs/tree/master/examples that just starts an IPFS node and shows the peer ID and agent version similar to the browser-create-react-app one?

@emclab
Copy link
Author

emclab commented Feb 16, 2020

Hi, I uploaded my test code to https://github.com/emclab/test_ipfs_nodejs_mobile_react_native. somehow I could not PR to the js-ipfs.

After clone the project on MacOS catalina, with Xcode 11.3 installed (Here is the RN get started). do the following:

  1. in project root, type yarn install
  2. cd to ios, type pod install
  3. from project root, cd nodejs-assets/nodejs-project
  4. type npm install ipfs
  5. in project root, type npx react-native run-ios

There will be build error. Please be noted that nodejs-mobile-react-native will not throw error if there is error in main.js (where ipfs is required). It just hangs without emitting any message. Thanks for checking.

@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