Webpacker Error or not found on rails 6.1.3

Install via npm

It is recommended to install Yarn through the npm package manager, which comes bundled with Node.js when you install it on your system.

Once you have npm installed you can run the following both to install and upgrade Yarn:

npm install --global yarn


yarn add webpack


bundle exec rails webpacker:install