LoginSignup
0
0

More than 3 years have passed since last update.

rails new アプリ名でアプリが作成されない

Posted at

該当箇所

Railsチュートリアル第3章
$ rails _6.0.3_ new sample_app
を実行すると、エラーが起こりアプリが作成されない。

期待する動作

$ rails _6.0.3_ new sample_appコマンドが正常に動作し、アプリが作成されること。

取り組んだこと

$ rails _6.0.3_ new sample_app

Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/

Yarnがインストールされていないようです。Yarnをインストールしてくださいと言われました。
なので、HomebrewのbrewコマンドでYarnをインストールします。

 $ brew install yarn

 bash: brew: command not found

次は、brewコマンドなんてないよと言われました。
ということはHomebrewがないのだと思い、Homebrewをインストールします。

 $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

 Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.

PATHが通っていませんよ、と言われました。
なので、PATHを通らせます。

$ echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >>  ~/.bashrc
source ~/.bashrc

これでHomebrewがインストールされYarnもインストールされました。

$ rails _6.0.3_ new sample_app

ちゃんとアプリが作成されました!!

結論

$ rails new アプリ名コマンドでアプリを作成するためには、Yarnをインストールする必要がある。
また、Yarnをインストールするためにはnpmでインストールする方法などもありますが、Homebrewでインストールできる。

参考

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