macos Mac Os Lion 上 ruby​​gems 上的“没有此类文件或目录 - getcwd”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9243548/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:51:53  来源:igfitidea点击:

"No such file or directory - getcwd" error on rubygems on Mac Os Lion

macosrubygemsheroku

提问by Michael Eilers Smith

I'm trying to launch a heroku consolethat uses rubygems but I keep getting this error:

我正在尝试启动一个使用 ruby​​gems的heroku 控制台,但我不断收到此错误:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:471:in `expand_path': No such file or directory - getcwd (Errno::ENOENT)
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:471:in `find_files'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:470:in `map'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:470:in `find_files'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1103
    from /usr/bin/heroku:9:in `require'
    from /usr/bin/heroku:9

I'm using Mac OS Lion 10.7.3. Any ideas on how to fix this? Thanks!

我使用的是 Mac OS Lion 10.7.3。有想法该怎么解决这个吗?谢谢!

采纳答案by Israfil Havilah

I had that same issue.... running sudo gem update --systemfixed the problem... give it a try.

我有同样的问题......运行sudo gem update --system解决了这个问题......试一试。

回答by gerardk

Maybe the current working directory of the shell that's used to start your heroku process doesn't exist (maybe removed by another process, as in my case), and therefore getcwd throws an error.

也许用于启动您的 heroku 进程的 shell 的当前工作目录不存在(可能被另一个进程删除,就像我的情况一样),因此 getcwd 会引发错误。

回答by kilojoules

This happened to me. It turned out I had deleted the folder I was running the command in.

这发生在我身上。原来我已经删除了我运行命令的文件夹。

回答by Mirror318

I had the same thing, just type cdin the terminal, then navigate back to where you were and it works.

我有同样的事情,只需cd在终端中输入,然后导航回您所在的位置即可。

回答by Vishnu Narang

Faced a similar issue while setting up rails app locally.

在本地设置 rails 应用程序时遇到了类似的问题。

The issue was that the server was running in a directory which i had removed from another terminal window to recreate the app.

问题是服务器正在一个目录中运行,我从另一个终端窗口中删除了该目录以重新创建应用程序。

Close terminal and do it again or go to some other directory and come back and do it...

关闭终端并再次执行或转到其他目录并返回并执行...

Anything should work..It did for me.

任何事情都应该有效..它对我有用。

回答by Christian

Tried starting the rails server in another console tab.

尝试在另一个控制台选项卡中启动 rails 服务器。

cd .solved it for me

cd .为我解决了

回答by David Zhang

I encounter a same one, it happened when the working directory has actually been removed.

我遇到了同样的情况,它发生在实际删除工作目录时。

回答by Neil Middleton

This doesn't appear to be Heroku issue as something in your code is requiring this getcwd.

这似乎不是 Heroku 问题,因为您的代码中的某些内容需要 this getcwd

What happens if you run this application locally in production mode? Have you defined all of your dependencies for Heroku (either via a .gems file or Bundler)

如果在生产模式下在本地运行此应用程序会发生什么?您是否为 Heroku 定义了所有依赖项(通过 .gems 文件或 Bundler

回答by Maciej.O

Restart system fixed this problem in my case

在我的情况下,重新启动系统解决了这个问题

回答by Aizzat Suhardi

as explained by gerardkyou could try this before launching back heroku console

正如 gerardk 所解释的,您可以在启动 heroku 控制台之前尝试此操作

$ pwd #ie: /mywork
$ cd ..
$ cd [pwd] #ie: cd mywork

now go launch back heroku console

现在去启动heroku控制台