1
0

More than 3 years have passed since last update.

(Rails tutorial)rails server がエラーになった際の備忘録

Last updated at Posted at 2021-08-26

rails tutorial(Rails 6.0)の内容に沿って進めていた時のメモです。

ぶち当たった現象&やってみたこと

rails s したら下記のような表示が出て、ローカルサーバーが起動せず。
(筆者は第2章にて)

=> Booting Puma
=> Rails 6.0.3 application starting in development 
=> Run `rails server --help` for more startup options
warning Integrity check: System parameters don't match                                                        
error Integrity check failed                                                                                  
error Found 1 errors.                                                                                         


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).


yarn check v1.22.5
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.


Exiting

第1章では特に問題なかったのにクソ〜と思いつつ、とりあえずエラー文を読んでみる。

Please run `yarn install --check-files` to update.

とあるので、ひとまず言われた通りに yarn install --check-files を実行。

ここでも下記のようにエラーっぽいのが出た。

・
・
・
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
error webpack-dev-server@4.0.0: The engine "node" is incompatible with this module. Expected version ">= 12.13.0". Got "10.24.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

nodeとモジュールの互換性がないとかそんな感じ?

ひとまず上記のエラーは無視して、もう一度 rails s を実行するも、また冒頭と同じエラーになり困った。

解決した方法

ググってみると、似たような状況について書いてくれている人たちがいて感謝…!
下記の流れでひとまず解決(ローカルサーバーは立ち上がるようになった)。

① node_modulesを削除

$ rm -rf node_modules/

② yarn.lockファイルを削除

$ rm -rf yarn.lock

③ yarnをインストール

$ yarn install

yarn install 後は「nodeとモジュールがなんたら…」といった上記と同様のエラーが出たが、この状態で再度 rails s を実行すると、無事ローカルサーバーが立ち上がった。

(ここではnodeのエラーは見なかったことに)

参考記事

下記の記事を参考にさせていただきました。ありがとうございました!

Rails6 開発時につまづきそうな webpacker, yarn 関係のエラーと解決方法

【解決】Your Yarn packages are out of date! Please run yarn install to update.

1
0
1

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
1
0