React Nativeでアプリを作成している時に、いろんなドキュメントを読みながらライブラリ等をインストールしていたのですが、ふと「expo install」と「npm install」の違いってなんだろうと思ったので調べて見ました。
仮説1:ダウンロード元が違う
npmでインストールしてみる
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$ npm install react-native-firebase npm WARN npm npm does not support Node.js v13.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > react-native-firebase@5.6.0 postinstall /Users/shimizu/workspace/ReactNative/news-app/node_modules/react-native-firebase > opencollective-postinstall && echo 'WARNING: react-native-firebase v5 will allow breaking changes in minor versions starting from v5.5.x, this is in order to continue supporting it prior to v6. Info: https://rnfirebase.io/docs/v5.x.x/releases/v5.4.x' || exit 0 Thank you for using react-native-firebase! If you rely on this package, please consider supporting our open collective: > https://opencollective.com/react-native-firebase/donate WARNING: react-native-firebase v5 will allow breaking changes in minor versions starting from v5.5.x, this is in order to continue supporting it prior to v6. Info: https://rnfirebase.io/docs/v5.x.x/releases/v5.4.x npm WARN @react-native-community/masked-view@0.1.5 requires a peer of react-native@^0.57 but none is installed. You must install peer dependencies yourself. npm WARN react-navigation-stack@2.1.1 requires a peer of react-native-screens@^1.0.0 || ^1.0.0-alpha.0 || ^2.0.0-alpha.20 but none is installed. You must install peer dependencies yourself. npm WARN react-navigation-tabs@2.7.0 requires a peer of react-native-screens@^1.0.0 || ^1.0.0-alpha but none is installed. You must install peer dependencies yourself. + react-native-firebase@5.6.0 added 2 packages from 2 contributors and audited 71276 packages in 39.562s found 4 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details |
package.jsonを確認
“react-native-firebase”: “^5.6.0”
expoでインストールしてみる。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$ expo install react-native-firebase Installing 1 other package using npm. > npm install --save react-native-firebase npm WARN npm npm does not support Node.js v13.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > react-native-firebase@5.6.0 postinstall /Users/shimizu/workspace/ReactNative/news-app/node_modules/react-native-firebase > opencollective-postinstall && echo 'WARNING: react-native-firebase v5 will allow breaking changes in minor versions starting from v5.5.x, this is in order to continue supporting it prior to v6. Info: https://rnfirebase.io/docs/v5.x.x/releases/v5.4.x' || exit 0 Thank you for using react-native-firebase! If you rely on this package, please consider supporting our open collective: > https://opencollective.com/react-native-firebase/donate WARNING: react-native-firebase v5 will allow breaking changes in minor versions starting from v5.5.x, this is in order to continue supporting it prior to v6. Info: https://rnfirebase.io/docs/v5.x.x/releases/v5.4.x + react-native-firebase@5.6.0 added 2 packages from 2 contributors and audited 71276 packages in 22.188s found 4 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details |
package.jsonを確認
“react-native-firebase”: “^5.6.0”
特に違いは見られない、、、
というか、2行目あたりでやっている通り、「npm install –save react-native-firebase」って感じで結局npmを読んでいるよう。。。
仮設2:expoでは使えないライブラリを弾いてくれる
expoでは使えないと噂のBluetooth系のライブラリを入れてみて、弾かれるのであればきっとそういうことになるでしょう。
では早速打ってみましょう。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ expo install react-native-ble-manager Installing 1 other package using npm. > npm install --save react-native-ble-manager npm WARN npm npm does not support Node.js v13.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ + react-native-ble-manager@7.1.2 added 1 package from 1 contributor and audited 71278 packages in 20.563s found 4 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details |
…普通にいけましたね…
一応他のやつでも確認
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
$ expo install install expo-in-app-purchases Installing 1 SDK 36.0.0 compatible native module and 1 other package using npm. > npm install npm WARN npm npm does not support Node.js v13.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ added 1 package from 1 contributor and audited 71278 packages in 20.924s found 4 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details > npm install --save install npm WARN npm npm does not support Node.js v13.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ + install@0.13.0 added 1 package from 1 contributor and audited 71279 packages in 23.96s found 4 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details |
特に問題なさそうですねぇ。。。
色々やってみてわかったこと
・npm uninstallはあるけど、expo uninstallは無い
・expo installはnpm install –saveでインストールを行う
結論
多分どっちも対して変わらない。
ドキュメント中に書いてあるコマンドを使うのが無難だけれども。
もし知っている方がいらっしゃったらコメント等で教えてほしいです!!
コメント