没有Sudo,流星会不会运行? [英] Meteor will not run without Sudo?

查看:126
本文介绍了没有Sudo,流星会不会运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OSX Yosemite和最新版本的流星(1.0.1)上,无论我卸载并重新安装了多少次,如果没有sudo,我似乎都无法使其运行.我的用户帐户是管理员帐户.但是流星拒绝在没有须藤的情况下奔跑.我遇到的错误全是:

On OSX Yosemite and the latest version of meteor (1.0.1), no matter how many times I uninstall and reinstall it, I can't seem to get it running without sudo. My user account is an administrator account. But meteor refuses to run without sudo. The errors I'm getting are all:

-bash: meteor: command not found

我在这里看到了一些类似问题的帖子.我尝试使用磁盘工具修复磁盘权限.我尝试过:

I've seen a few posts on here with similar problems. I've tried repairing disk permissions with disk utility. I've tried:

sudo chown -R $myUsername /usr/local/bin/meteor

我不确定我还能做什么,因为这似乎是权限问题.有人有什么建议吗?

I'm not sure what else I can do, because it seems to be a permissions issue. Does anyone have any suggestions?

可能有帮助的其他信息:

Additional info that might help:

$ sudo which meteor
/usr/local/bin/meteor
$ sudo ls -l /usr/local/bin/meteor
-rwxrwxrwx 1 root wheel 3528 Dec 18 23:14 /usr/local/bin/meteor
$ ls -ld /usr/local/bin
drwx------ 6 502 wheel 204 Dec 18 23:14 /usr/local/bin

顺便说一句,ls -l /usr/local/bin/meteor仅适用于sudo.

By the way, ls -l /usr/local/bin/meteor only works with sudo.

推荐答案

在我们弄清了meteor可执行文件及其基本目录的权限之后, 问题变得很明显:

After we clarified the permissions of the meteor executable and its base directory, the problem became quite clear:

  • 流星二进制文件位于/usr/local/bin/meteor
  • 您的用户没有目录/usr/local/bin
  • 的权限
  • The Meteor binary is located in /usr/local/bin/meteor
  • Your user didn't have permission to the directory /usr/local/bin

解决步骤:

  1. 在基本目录上添加权限:sudo chmod +rx /usr/local/bin
  2. 如有必要,将基本目录添加到PATH:PATH=$PATH:/usr/local/bin
  1. Add permission on the base directory: sudo chmod +rx /usr/local/bin
  2. If necessary, add the base directory to PATH: PATH=$PATH:/usr/local/bin

供以后参考:

  • 出现此类错误时:-bash: XYZ: command not found
    • 首先要检查的是找到XYZ的绝对路径,例如/path/to/XYZ
    • 尝试使用绝对路径/path/to/XYZ
    • 运行
    • When you get this kind of error: -bash: XYZ: command not found
      • The first thing to check is find the absolute path of XYZ, for example /path/to/XYZ
      • Try to run with the absolute path /path/to/XYZ
      • 您需要对文件本身具有读取和执行权限:sudo chmod +rx /path/to/XYZ
      • 您需要对所有导致该文件的路径元素具有exec权限:sudo chmod +x /path /path/to
      • You need read and exec permission on the file itself: sudo chmod +rx /path/to/XYZ
      • You need exec permission on all path elements leading up to the file: sudo chmod +x /path /path/to

      注意:上面的sudo chmod命令为所有用户(所有者+组+其他)授予权限(读取和执行).对于OP(在大多数情况下),这是完全可以的. 在权限设置更为复杂的情况下,您可能需要更加具体,并使用g+rx而不是+rx.

      Note: the above sudo chmod commands give permissions (read and exec) to all users: owner + group + other. In the case of the OP (and in most common cases), this is perfectly fine. In situations with more sophisticated permission setup, you might need to be more specific, and use g+rx instead of +rx.

      (用于记录)

      如果它与sudo一起使用,而没有sudo,则得到command not found,这意味着meteorPATH上位于root上,但不适用于您的用户.为了使其适合您的用户,您需要找到meteor的路径并将其添加到用户的PATH.例如:

      If it works with sudo, and without sudo you get command not found, that means that meteor is on the PATH for root but not for your user. To make it work for your user, you need to find the path to meteor and add it to your user's PATH. For example:

      1. 成为sudo su -
      2. 的root
      3. 找到meteor的路径,运行命令:which meteor
      4. 从根目录(Control-D)注销以返回您的用户
      5. 将基本目录添加到PATH,例如,如果以前的which meteor给了您/usr/local/bin/meteor,则请执行以下操作:PATH=$PATH:/usr/local/bin
      1. Become root with sudo su -
      2. Find the path of meteor, run command: which meteor
      3. Logout from root (Control-D) to return to your user
      4. Add the base directory to PATH, for example if earlier which meteor gave you /usr/local/bin/meteor, then do this: PATH=$PATH:/usr/local/bin

      此后,它应该与您的用户一起使用.要使其永久",请在~/.bashrc中添加最后一步.

      After this, it should work with your user. To make it "permanent", add the last step in your ~/.bashrc.

      如果这仍然不起作用,则说明您的用户没有对该文件的执行权限.使用以下命令修复该问题:

      If this still doesn't work, then perhaps your user doesn't have the execute permission on the file. Fix that with this command:

      sudo chmod +x /usr/local/bin/meteor
      

      从您的评论看来,您的用户似乎也没有对/usr/local/bin目录本身的权限.使用以下命令修复该问题:

      From your comments it also seems your user doesn't have permission on the /usr/local/bin directory itself. Fix that with this command:

      sudo chmod +rx /usr/local/bin
      

      这篇关于没有Sudo,流星会不会运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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