无法为我的React Native App安装Realm [英] Can not install Realm for my React Native App

查看:58
本文介绍了无法为我的React Native App安装Realm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的React本机应用程序安装Realm,但出现以下错误,你能建议出什么问题吗?

I am trying to install Realm for my React native app and I get the following error, could you suggest what might be wrong.

我正在使用命令

npm install --save realm

从网络上- https://realm.io/docs/javascript/latest/

错误:

npm ERR! Failed at the realm@2.11.0 install script.

我尝试安装

npm install -g node-pre-gyp

npm install -g node-gyp

仍然无效.任何建议都会很有帮助

Still did not work. any suggestions would be very helpful

谢谢 R

这是我的日志

    npm install --save realm

> realm@2.11.0 install C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/2.11.0/realm-v2.11.0-node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for realm@2.11.0 and node@10.1.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:165:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Development\\abcd-Retail-ReactNative\\retail-native-app\\node_modules\\realm\\compiled\\node-v64_win32_x64\\realm.node" "--module_name=realm" "--module_path=C:\\Development\\abcd-Retail-ReactNative\\retail-native-app\\node_modules\\realm\\compiled\\node-v64_win32_x64"
gyp ERR! cwd C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm
gyp ERR! node -v v10.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
configure --fallback-to-build --module=C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm\compiled\node-v64_win32_x64\realm.node --module_name=realm --module_path=C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm\compiled\node-v64_win32_x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:957:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:246:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Development\\abcd-Retail-ReactNative\\retail-native-app\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm
node-pre-gyp ERR! node -v v10.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm\compiled\node-v64_win32_x64\realm.node --module_name=realm --module_path=C:\Development\abcd-Retail-ReactNative\retail-native-app\node_modules\realm\compiled\node-v64_win32_x64' (1)
npm WARN eslint-plugin-react-native@3.2.1 requires a peer of eslint@^3.17.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native@0.55.4 requires a peer of react@16.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-looped-carousel@0.1.13 requires a peer of react-native@^0.54.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! realm@2.11.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the realm@2.11.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rao\AppData\Roaming\npm-cache\_logs\2018-06-28T14_42_35_122Z-debug.log

推荐答案

感谢@Ashwin Mothilal,我不得不回到稳定的Node版本(v8.11.3).我是怎么做到的.

Thanks @Ashwin Mothilal, I had to go back to a stable version of Node (v8.11.3). How I did it.

花了一段时间才能弄清楚整个过程,写下我执行的步骤.希望这会有所帮助

It took a while to figure out the entire procedure, writing down the steps I performed. Hope this helps

1-完全从我的计算机上卸载了Node.js. (视窗) 关注了此链接-[如何完全删除node.js从Windows (不要忘记重启电脑)

1 - Uninstalled Node.js completely from my machine. (Windows) Followed this link - [How to completely remove node.js from Windows (Dont forget to restart your PC)

2-从以下位置下载并安装了稳定版本(8.11.3 LTS): [ https://nodejs.org/en/][1]

2 - Downloaded and Installed the stable version (8.11.3 LTS) from - [https://nodejs.org/en/][1]

3-重新启动计算机.

3 - Restart your machine.

4-现在检查节点版本(>>节点-v).

4 - Check the node version now (>> node -v).

5-在您的项目中,删除所有node_modules- rm -rf node_modules/ npm安装 关联 - [如何清理未在package.json中的软件包的node_modules文件夹?

5 - In your project remove all node_modules - rm -rf node_modules/ npm install link - [How to clean node_modules folder of packages that are not in package.json?

6-然后在您的项目中执行->> npm install. 这应该安装所有必需的依赖项.

6 - then do - >>npm install in your project. This should install all the required dependencies.

7-现在安装Realm.

7 - Now install Realm.

npm install --save realm

这已成功将Realm添加到我的项目中.

This has successfully added Realm to my project.

注意: 当我收到我在实际问题中发布的错误时,它建议我安装"node-pre-gyp". 我尝试安装

Note: When I was getting this errors which I have posted in my actual question, It recommended me to install 'node-pre-gyp'. I tried to install

  npm install --save node-pre-gyp --fallback-to-build
  npm install --save node-pre-gyp
  npm install -g node-pre-gyp 

这不起作用,因此在执行上面提供的步骤之前,我已经删除了"node-pre-gyp".如果您已安装上述任何软件,则可以将其删除,因为这不是必需的.

Which did not work, so Before I did the steps provided above I have removed 'node-pre-gyp'. In case you have installed any of the above you can please remove them as it was not required.

希望这会有所帮助. R

Hope this helps. R

这篇关于无法为我的React Native App安装Realm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆