0
1

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.

rails6でherokuにデプロイしたときにwebpackerに関するエラーに遭遇

Posted at

rails6で初めてデプロイしたときにエラーにつまずいた

##エラー内容
調べてみたところnode-scssのバージョンがnodeのバージョンと違うとのこと

warning " > webpack-dev-server@3.11.0" has unmet peer dependency
"webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
error /tmp/build_4354b829/node_modules/node-sass: Command failed.

解決方法

①webpackerのバージョンアップ

- gem 'webpacker', '~> 4.0' //削除
+ gem 'webpacker', '~> 5.0' //追加

②yarn.lockの削除

ファイルをそのまま消去

③package.json

次に、package.jsonに"@rails/webpacker": "5.4.3"を追記します。

④yarn install

$ yarn install

⑤ yarn add node-sass

$ yarn add node-sass

これで解決しました

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?