Macbook React Native安装 [英] Macbook React Native install

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

问题描述

npm WARN checkPermissions缺少对的写入权限 /usr/local/lib/node_modules npm错误!路径/usr/local/lib/node_modules npm ERR!代码EACCES npm ERR! errno -13 npm错误! syscall访问npm 呃!错误:EACCES:权限被拒绝,访问权限 '/usr/local/lib/node_modules'npm错误! {错误:EACCES:权限 拒绝,访问'/usr/local/lib/node_modules'npm ERR!堆栈:错误: EACCES:权限被拒绝,访问\'/usr/local/lib/node_modules \'', npm ERR! errno:-13,npm错误!代码:"EACCES",npm错误!系统调用: 访问",npm错误!路径:'/usr/local/lib/node_modules'} npm ERR! npm ERR!请尝试以root/管理员身份再次运行此命令.

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR!可以在以下位置找到此运行的完整日志: /Users/fatihcanbekli/.npm/_logs/2017-12-29T22_23_07_790Z-debug.log

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/fatihcanbekli/.npm/_logs/2017-12-29T22_23_07_790Z-debug.log

当我尝试开始时. npm install-g react-native-cli.我正在处理此错误.我该怎么办?

When I try to start. npm install - g react-native-cli. I am taking this error. What can I do?

推荐答案

这只是一个权限问题.基本上,NPM尝试写入由root拥有的目录.有几种方法可以解决此问题.

This is simply a permission problem. Basically NPM is trying to write to a directory that is owned by root. There are a few ways to get around this.

  1. 您可以在文档此处使用推荐的解决方案.基本上,它建议您使用软件包管理器.例如,如果您使用的是OSX,Home Brew就是一个很好的选择.

  1. You can use the recommended solution from the docs here. Basically it suggest you use a package manager. For example Home Brew is a great one if you are using OSX.

您可以使用sudo安装软件包.但是,这可能会导致您遇到其他问题,并且很多人对此感到恐惧.换句话说,

You can install the packages using sudo. This could cause you other problems though and a lot of people freak out about this. In other words,

sudo npm install-g react-native-cli

sudo npm install - g react-native-cli

您可以更新此文件夹的权限,以允许在其中安装内容.这意味着您的用户有权写入/usr/local/lib/.在终端中输入此命令,

You could update the permissions on this folder allowing you to install things to it. This would mean that your user has the right to write to /usr/local/lib/. Type this command into the terminal,

sudo chown -R $ USER/usr/local

sudo chown -R $USER /usr/local

有时,取决于您的系统,需要采取不同的步骤.这实际上是一个非常普遍的问题,并且在我们更新系统操作系统时通常会发生在我们身上.如果这是您第一次看到这种机会,那么您将再次看到它.因此,请尝试环顾四周并阅读有关该问题的信息.您会发现很多时候,解决方案是使用homebrew之类的东西进行安装.有时homebrew会在新操作系统问世时出现权限问题.这些解决方案始终是chownchmod的某种组合,以赋予用户帐户对特定目录的写访问权限.

Sometimes depending on your system different steps need to be taken. This is actually a very common problem and typically happens to us when we update our systems OS. If this is the first time you have seen this chances are you will see it again. So try and look around and read about the problem. You will notice a lot of the times the solution is to use something like homebrew to install things. Sometimes homebrew can have a permission problem when a new OS comes out. These solutions are always some combination of chown or chmod to give a user's account write access to a specific directory.

有关HomeBrew的更多信息,请参阅此链接.

For more information on HomeBrew please see this link.

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

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