简体   繁体   中英

How do I use morris.js with Rails 6 and webpacker?

I'm not new to Rails, but I'm new to Rails 6 & webpacker. I'm trying to integrate morris.js (and raphael.js) into my app. I've done:

 yarn add raphael
 yarn add morris

In app/views/layouts/application.html.erb

<%= javascript_pack_tag 'raphael' %>
<%= javascript_pack_tag 'morris' %>

This is my error:

Webpacker can't find raphael in /Users/jarvis/rails/stuper/public/packs/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest. Your manifest contains:

got it working by

rm -rf node_modules
yarn install

then i simply added morris-rails and raphael-rails gems

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM