I am trying to add IPFS to react native app with nodes-mobile-react-native. Here is the steps I took on macOS Catalina with Xcode 11.2 and its command line tools installed
- create a react native project RN 0.61.5
- install nodes-mobile-react-native 0.5.0. node version 10.17.0
- test launch the react native app successfully
- yarn global add ipfs (0.40.0) with success
- test launch the app and it failed (failed at gc-stats@1.4.0 install script)
The failed message is:
gyp info using node@10.17.0 | darwin | x64
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode
gyp verb which
succeeded for make
/Applications/Xcode.app/Contents/Developer/usr/bin/make
gyp info spawn make
gyp info spawn args [ āV=1ā, āBUILDTYPE=Releaseā, ā-Cā, ābuildā ]
c++ ā-DNODE_GYP_MODULE_NAME=gcstatsā ā-DUSING_UV_SHARED=1ā ā-DUSING_V8_SHARED=1ā ā-DV8_DEPRECATION_WARNINGS=1ā ā-DNODE_ENGINE=āchakracoreāā ā-DNODE_ENGINE_CHAKRACOREā ā-D_DARWIN_USE_64_BIT_INODE=1ā ā-D_LARGEFILE_SOURCEā ā-D_FILE_OFFSET_BITS=64ā ā-DBUILDING_NODE_EXTENSIONā -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/include/node -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/src -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/deps/openssl/config -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/deps/openssl/openssl/include -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/deps/uv/include -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/deps/zlib -I/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/deps/chakrashim/include -Iā¦/src -Iā¦/ā¦/nan -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk -Os -gdwarf-2 -mios-simulator-version-min=9.0 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/gcstats/src/gcstats.o.d.raw -c -o Release/obj.target/gcstats/src/gcstats.o ā¦/src/gcstats.cc
In file included from ā¦/src/gcstats.cc:1:
ā¦/ā¦/nan/nan.h:141:9: warning: āTYPE_CHECKā macro redefined [-Wmacro-redefined]
#define TYPE_CHECK(T, S)
^
/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-react-native/ios/libnode/include/node/v8.h:85:9: note: previous definition is here
#define TYPE_CHECK(T, S)
^
ā¦/src/gcstats.cc:71:40: error: no member named ānumber_of_native_contextsā in āv8::HeapStatisticsā
info->numberOfNativeContexts = stats->number_of_native_contexts();
~~~~~ ^
ā¦/src/gcstats.cc:72:42: error: no member named ānumber_of_detached_contextsā in āv8::HeapStatisticsā
info->numberOfDetachedContexts = stats->number_of_detached_contexts();
~~~~~ ^
1 warning and 2 errors generated.
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-gyp/lib/build.js:248:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command ā/usr/local/bin/nodeā ā/Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-gyp/bin/node-gyp.jsā ābuildā āāfallback-to-buildā āāmodule=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-arch/gcstats.nodeā āāmodule_name=gcstatsā āāmodule_path=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-archā āānapi_version=5ā āānode_abi_napi=napiā āānapi_build_version=0ā āānode_napi_label=node-v64ā
gyp ERR! cwd /Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats
gyp ERR! node -v v10.17.0
gyp ERR! node-gyp -v v0.3.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute ā/usr/local/bin/node /Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-arch/gcstats.node --module_name=gcstats --module_path=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-arch --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64ā (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 19.0.0
node-pre-gyp ERR! command ā/usr/local/bin/nodeā ā/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/node_modules/.bin/node-pre-gypā āinstallā āāfallback-to-buildā
node-pre-gyp ERR! cwd /Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats
node-pre-gyp ERR! node -v v10.17.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute ā/usr/local/bin/node /Users/zhouyiyun/Documents/js/ipat1/node_modules/nodejs-mobile-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-arch/gcstats.node --module_name=gcstats --module_path=/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node_abi-platform-arch --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64ā (1)
npm verb lifecycle gc-stats@1.4.0~install: unsafe-perm in lifecycle true
npm verb lifecycle gc-stats@1.4.0~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats/node_modules/.bin:/Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.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/ipat1/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
npm verb lifecycle gc-stats@1.4.0~install: CWD: /Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.app/nodejs-project/node_modules/gc-stats
npm info lifecycle gc-stats@1.4.0~install: Failed to exec install script
npm verb stack Error: gc-stats@1.4.0 install: node-pre-gyp install --fallback-to-build
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:198:13)
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:198:13)
npm verb stack at maybeClose (internal/child_process.js:982:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm verb pkgid gc-stats@1.4.0
npm verb cwd /Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Products/Debug-iphonesimulator/ipat1.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 v10.17.0
npm verb npm v6.13.4
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gc-stats@1.4.0 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gc-stats@1.4.0 install 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 188997ms
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhouyiyun/.npm/_logs/2020-01-27T21_56_33_992Z-debug.log
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ [NODEJS\ MOBILE]\ Build\ Native\ Modules /Users/zhouyiyun/Documents/js/ipat1/ios/build/ipat1/Build/Intermediates.noindex/ipat1.build/Debug-iphonesimulator/ipat1.build/Script-3D9C0B9C5DB7920B91BE5EFF.sh
(1 failure)
I did test that node-gyp was installed properly. What else was missing here?