“No such file or directory - getcwd” error on ruby

2019-02-02 19:41发布

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

/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!

12条回答
Fickle 薄情
2楼-- · 2019-02-02 20:20

Tried starting the rails server in another console tab.

cd . solved it for me

查看更多
够拽才男人
3楼-- · 2019-02-02 20:25

This doesn't appear to be Heroku issue as something in your code is requiring 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)

查看更多
Ridiculous、
4楼-- · 2019-02-02 20:26

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

查看更多
5楼-- · 2019-02-02 20:26

Faced a similar issue while setting up rails app locally.

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.

查看更多
够拽才男人
6楼-- · 2019-02-02 20:28

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

查看更多
Emotional °昔
7楼-- · 2019-02-02 20:28

as explained by gerardk you could try this before launching back heroku console

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

now go launch back heroku console

查看更多
登录 后发表回答