Comments (7)
mac本体での手順
ReactNativeインストール
$ brew install watchman
$ npm install -g react-native-cli
プロジェクト作成
$ react-native init estate_native
コマンドで起動
$ react-native run-ios
X-CODEで起動
from estate-sample.
iOS エミュレータのconsole.log
safari の開発ツールから以下がひらけた
from estate-sample.
jsからfabricのメソッドを読み込んでみる。これがいければ、署名いける
from estate-sample.
npm install で fabric の関連lib入れると以下エラーが発生して起動できない?
それかそもそも npm install はしちゃだめとか。
それかそもそも npm install はしちゃだめとか。
npm install しただけでこちらのエラーになった。これが原因か。
以下で同じような内容を質問してるけど、答えがない
https://stackoverflow.com/questions/55671556/index-js-cannot-find-module-react-native-community-cli-node-modules-metro
from estate-sample.
プロジェクトの作り方が最近新しくなったらしい
【React Native】Expo CLIを利用してReact Nativeプロジェクトを作成する
expo-cli を使うようにする
$ npm install -g expo-cli
$ expo init my-app
$ cd my-app
$ yarn start
その後、i をおすと iOSシミュレーターが起動
あとは、普通の開発。
fabric lib 試す
以下追加してinstallしたが、
"fabric-ca-client": "^1.4.1",
"fabric-client": "^1.4.1",
"fabric-common": "^1.4.1",
"fabric-network": "^1.4.1"
以下エラー
$ yarn install
yarn install v1.15.2
[1/4] 🔍 Resolving packages...
warning fabric-client > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning fabric-network > fabric-client > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[2/4] 🚚 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^8.9.0". Got "11.13.0"
error Found incompatible module
node の version落とさないといけないと。
nodeのversion落とす
https://qiita.com/kuriya/items/36ae29366df0b7c95dec
$ brew uninstall --ignore-dependencies node
$ brew install nodebrew
$ mkdir -P /Users/shohu33/.nodebrew/src/v8.16.0/
$ nodebrew install-binary v8.16.0
$ nodebrew use v8.16.0
use v8.16.0
~/.bashrcのファイルに以下パスを追加します。
export PATH=$HOME/.nodebrew/current/bin:$PATH
setup
$ nodebrew setup
で、version確認。できた
$ node -v
v8.16.0
備考
downloadのフォルダ作成しなかったら以下エラー。このため、あらかじめ作成しておいた。
$ nodebrew install-binary v8.16.0
Fetching: https://nodejs.org/dist/v8.16.0/node-v8.16.0-darwin-x64.tar.gz
Warning: Failed to create the file
Warning: /Users/shohu33/.nodebrew/src/v8.16.0/node-v8.16.0-darwin-x64.tar.gz:
Warning: No such file or directory
0.0%
curl: (23) Failed writing body (0 != 1059)
以下実施すればよかったとのこと
$ nodebrew setup
再度 fabricをinstall
warningはでたがうまくいった
$ yarn install
yarn install v1.15.2
[1/4] 🔍 Resolving packages...
warning fabric-client > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning fabric-network > fabric-client > [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "expo > [email protected]" has unmet peer dependency "@types/googlemaps@^3.0.0".
warning "expo > [email protected]" has unmet peer dependency "@types/markerclustererplus@^2.1.29".
warning "expo > [email protected]" has unmet peer dependency "@types/react@^15.0.0 || ^16.0.0".
warning "expo > [email protected]" has incorrect peer dependency "[email protected]".
warning "expo > [email protected]" has incorrect peer dependency "react-native@^0.44.1".
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > [email protected]" has unmet peer dependency "@babel/core@*".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 28.86s.
起動
ただ、このnode versionだと起動しないっぽい
$ yarn start
yarn run v1.15.2
$ expo start
Starting project at /Users/shohu33/sc/estate-expo
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Something went wrong installing the "sharp" module
The module '/usr/local/lib/node_modules/expo-cli/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
- Ensure the version of Node.js used at install time matches that used at runtime
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues
error Command failed with exit code 1.
なんで、expo-cli を入れ直してみた。
$ npm remove -g expo-cli
$ npm install -g expo-cli
そのご、fabricのlibをpackage.confにいれて yarn install したあと、yarn startで起動して途中で "i" をおしたらうまくいった
from estate-sample.
fabricのテストソースのっけたら、fsモジュールがない問題
また、fsか。。。
React Nativeは Node.jsで実行されていなかった
ん、react native でもだめ・・・?
ではなくて、1つ1つ
$ yarn add fs
のようにnodeの標準packageと思われるものも install してあげる必要があと思ったらこれでもだめ。
React Native: Unable to resolve module fs
こっちか。react-native-fs を使えといっている。
いや、node の core module 使えるようになる
npm install rn-nodeify
こちらがよさそう.
package.json を変更して以下のようにして、 yarn postinstall 実行
"scripts": {
:
"postinstall": "rn-nodeify --install fs,path,console --hack"
事前に以下いれておく
$ npm install node-pre-gyp -g
うまくいったっぽい?
$ yarn postinstall
yarn run v1.15.2
$ rn-nodeify --install fs,path,console --hack
not overwriting "react-native-level-fs"
not overwriting "path-browserify"
not overwriting "console-browserify"
normalized "main" browser mapping in readable-stream, fixed here: https://github.com/facebook/metro-bundler/pull/3
hacking /Users/shohu33/sc/estate-expo/node_modules/form-data/package.json
hacking /Users/shohu33/sc/estate-expo/node_modules/iconv-lite/package.json
hacking /Users/shohu33/sc/estate-expo/node_modules/immediate/package.json
hacking /Users/shohu33/sc/estate-expo/node_modules/readable-stream/readable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/levelup/lib/util.js
hacking /Users/shohu33/sc/estate-expo/node_modules/fwd-stream/node_modules/readable-stream/readable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/levelup/node_modules/readable-stream/readable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_writable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_readable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/level-blobs/node_modules/readable-stream/lib/_stream_readable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/level-blobs/node_modules/readable-stream/lib/_stream_writable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/levelup/node_modules/readable-stream/lib/_stream_writable.js
hacking /Users/shohu33/sc/estate-expo/node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js
✨ Done in 1.29s.
その後もう1度、 yarn install 。これがなぜか必要。
次は以下エラー
Unable to resolve "asyncstorage-down" from "node_modules/react-native-level-fs/index.js"
Failed building JavaScript bundle.
このため、以下入れる
yarn add asyncstorage-down
次は以下。crypto がないって。
The package at "node_modules/fabric-client/lib/hash.js" attempted to import the Node standard library module "crypto". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo
Failed building JavaScript bundle.
https://www.npmjs.com/package/rn-nodeify
をみると
If you are using the crypto shim, you will need to manually uncomment the line to require('crypto') in shim.js, this is because as of react-native 0.49, dynamically requiring a library is no longer allowed.
とのこと。なので、shim.js の require('crypto') 部分をuncomment
さらに、postinstall に crypto 追加
"postinstall": "rn-nodeify --install fs,path,console,crypto --hack"
またあとで色々足りないとでて最終的に以下
"postinstall": "rn-nodeify --install child_process,constants,assert,zlib,https,http,stream,fs,path,console,crypto,os,events --hack"
ただ、child_process に rn-nodeify が対応していない、、、
The package at "node_modules/grpc/node_modules/detect-libc/lib/detect-libc.js" attempted to import the Node standard library module "child_process". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo
Failed building JavaScript bundle.
以下の rn-nodeify みると、child_process は なさそうだが、processでもいけないみたい。。。
https://github.com/mvayngrib/rn-nodeify/blob/master/shims.js
from estate-sample.
How did you figure it out? I am getting the same error.
from estate-sample.
Related Issues (15)
- 要件定義
- Node.js が使えるクライアントアプリを見つけてfabric libを使う HOT 13
- queryByChaincode が offlineでも使えるか調べる HOT 6
- sendSignProposalを調べる HOT 3
- fabric-ca-client の中身を探る
- Electronで画面を作る HOT 1
- データモデル定義 HOT 3
- nodeのフレームワーク選定 HOT 3
- 開発方針の決定 HOT 6
- fabricのロールバック処理対応
- chainnodeを動かす HOT 3
- 起動用script作成
- Estate売買実装 HOT 6
- Client側で秘密鍵&公開鍵を作成してtransaction実行させてみる HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from estate-sample.