0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Windows][Vagrant] /usr/bin/env: ‘ruby\r’: No such file or directory 解決法

Posted at

起こったこと

Vagrant でWindows 上にVM 立てて
開発環境を利用している場合、

異なるOS間での プロジェクト のファイル共有をするため
改行コードなどの問題で
以下のような問題が起こることがある
( 特に、Windows Host側で gitを使用すると 自動で改行コード変換される機能のため git stash などすると発生

Rails サーバーが立ち上がらない..

$ bin/rails server
/usr/bin/env: ‘ruby\r’: No such file or directory

原因

VM使用のため
異なるOS間での プロジェクト のファイル共有をしているため
改行コードなどの問題で
上手くファイルを読み取れていないよう..

解決法

改行コードを変換する

unix2doc を利用

$ sudo yum install uni2doc
$ dos2unix bin/*
dos2unix: converting file bin/rails to Unix format...
...

->
実行できた

以後対策

そして

Windows HOST側の git の変換も止めておく..

git config --global core.autocrlf false
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?