为什么react-Native无法正常工作ubuntu 20.04

时间:2020-06-17 23:56:36

标签: react-native ubuntu

当我尝试使用npm进行安装时,出现以下控制台文字

 guilherme@guilherme-Aspire-A515-52G:~$  npm install -g react-native-cli  npm WARN checkPermissions Missing write access to /usr/local/lib npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib' npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib'] npm ERR!   stack: npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib\'', npm ERR!   errno: -13, npm ERR!   code: 'EACCES', npm ERR!   syscall: 'access', npm ERR!   path: '/usr/local/lib' } npm ERR!  npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR!  npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR!     /home/guilherme/.npm/_logs/2020-06-17T23_39_26_149Z-debug.log guilherme@guilherme-Aspire-A515-52G:~$ ^C guilherme@guilherme-Aspire-A515-52G:~$

所以我尝试使用yarn并可以工作,但不能100% 因为,这一次我写

react-native init myProject 

我收到如下错误:

找不到返回命令!

任何对此的帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

Mano,我们通常会在博览会上展出,例如servindo bem,au olhada nadocumentação,bem simples https://expo.io/learn

安装博览会:

npm install expo-cli --global

Cria um projeto:

expo init nomeDoSeuApp

意大利面食:

cd nomeDoSeuApp

E da um start na servidor:

expo start 

最喜欢使用simulador的android系统,使用de nois da a终端代码不能使用simuador的应用程序


我正在使用expo cli,它为我提供了很好的服务,请看一下https://expo.io/learn文档。

首先,在全局范围内安装它:

npm install expo-cli --global

创建一个项目:

expo init nameOfYourApp

进入文件夹:

cd nameOfYourApp

启动服务器:

expo start 

如果您使用的是Android模拟器,请在终端上显示二维码后输入a,该应用将在模拟器上自动启动。