首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建react本机应用程序时出现错误

创建react本机应用程序时出现错误
EN

Stack Overflow用户
提问于 2019-05-14 12:56:28
回答 1查看 2K关注 0票数 1

我已经安装了Nodejs、Java、Python和android studio,并安装了create-react-native-appby命令

npm install -g create-react-native-app

在那之后,我要跑步

sudo create-react-native-app MyFirstNative

但是得到了错误

我已经更新了npm、expo-cli等命令,甚至将命令与sudo一起使用时也会出现权限错误

代码语言:javascript
复制
azad@azadhussain:/var/www/html/githubrepo$ sudo create-react-native-app MyFirstNative
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│   There is a new version of expo-cli available (2.17.2).    │
│   You are currently using expo-cli 2.17.1                   │
│   Run `npm install -g expo-cli` to get the latest version   │
│                                                             │
└─────────────────────────────────────────────────────────────┘
? Choose a template: expo-template-tabs
✔ Please enter a few initial configuration values.
  Read more: https://docs.expo.io/versions/latest/workflow/configuration/ · 100% completed
Extracting project files...
Customizing project...
Initialized a git repository.
Installing dependencies...
npm WARN deprecated core-js@1.2.7: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/expo/react-native-maps.git
npm ERR! 
npm ERR! fatal: failed to stat '/var/www/html/githubrepo/MyFirstNative': Permission denied
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/azad/.npm/_logs/2019-05-14T04_30_21_275Z-debug.log
npm exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
azad@azadhussain:/var/www/html/githubrepo$

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-20 17:10:24

我通过更改我的.npm目录的权限解决了这个问题。我访问了npm全局目录,它位于

/home/<user-name>

我通过输入以下命令转到此目录

cd /home/<user-name>

然后通过输入以下命令更改了.npm文件夹的权限。

sudo chmod -R 777 ".npm"

它对我来说就像是一种魔力。但这有一个安全缺陷,即所有级别都可以访问您的全局包目录。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56123241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档