找不到变量:自我/无法安装firebase [英] Can't find variable : Self / Can't install firebase

查看:73
本文介绍了找不到变量:自我/无法安装firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在React-Native/Expo中开发一个应用程序,但无法安装Firebase.

I work on an App in React-Native / Expo and I can't install firebase.

  1. 我在Expo中创建了一个新的Projet:"test2". (没问题)

  1. I create a new Projet in Expo : "test2". (No problem)

我运行"npm install --save firebase"在cmd中,我得到了这个:

I run "npm install --save firebase" in cmd and i got this :

C:\Users\Nils\test>npm install --save firebase   
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download 
Success: "C:\Users\Nils\test\node_modules\grpc\src\node\extension_binary\ node-v57-win32-x64-unknown\grpc_node.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
+ firebase@5.4.2
added 179 packages from 71 contributors, removed 369 packages, updated 643 packages and audited 20975 packages in 440.187s
found 0 vulnerabilities**

  1. Expo告诉我我没有React-Native,应该使用"npm install" (奇怪的是,新项目在Firebase之前的5分钟前运行良好):

错误:未安装React native.请在您的项目目录中运行npm install.

Error: React native is not installed. Please run npm install in your project directory.

  1. 我运行"npm install"在cmd中:

C:\Users\Nils\test>npm install 
added 260 packages from 160 contributors, updated 4 packages and audited     30579 packages in 121.866s
found 2 vulnerabilities (1 low, 1 high) run `npm audit fix` to fix them,     or `npm audit` for details**

5我在Expo中运行了我的App,我得到了: 找不到变量:自我

5 I run my App in Expo and I got : Can't find variable : Self

我不明白为什么它不起作用,我什至不知道问题出在哪里...

I don't understand why it doesn't work, I don't even know where the problem is comming from ...

推荐答案

对于使用expo-cli或XDE创建新项目的用户,您的第一个纱线"或"npm install".这是因为昨天发布了新的"whatwg-fetch" 3.0.0( https://www. npmjs.com/package/whatwg-fetch 23). 因此,您只需要强制对先前版本的依赖即可: "whatwg-fetch": "^2.0.4" 这意味着将其作为"dependency"放入package.json中.手动添加"yarn add whatwg-fetch@2.0.4".或使用"npm添加whatwg-fetch@2.0.4".

For users creating new project with expo-cli or XDE, you will get red screen "Can’t Find Variable Self" after your first "yarn" or "npm install". This is because of new "whatwg-fetch" 3.0.0 published yesterday (https://www.npmjs.com/package/whatwg-fetch 23). So you just need to force dependency to previous version: "whatwg-fetch": "^2.0.4" It means put it in package.json as "dependency". Manually, with "yarn add whatwg-fetch@2.0.4." Or with "npm add whatwg-fetch@2.0.4".

现在一切都应像魅力一样.

Everything should now work like a charm.

希望这会有所帮助; p

Hope this helps ;p

链接:

https://forums.expo.io/t/cant-find-variable-self/13547

这篇关于找不到变量:自我/无法安装firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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