Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Template::Error: couldn't find file 'jquery-ui/jquery-ui.min.js' with type 'application/javascript' #1688

Closed
sentry-io bot opened this issue May 6, 2022 · 14 comments · Fixed by #1692 or #1697

Comments

@sentry-io
Copy link

sentry-io bot commented May 6, 2022

Sentry Issue: MAPKNITTER-7A

Sprockets::FileNotFound: couldn't find file 'jquery-ui/jquery-ui.min.js' with type 'application/javascript'
Checked in these paths: 
  /app/app/assets/images
  /app/app/assets/javascripts
  /app/app/assets/stylesheets
  /app/vendor/assets/images
  /app/vendor/assets/javascripts
  /app/vendor/assets/stylesheets
  /usr/local/bundle/ruby/2.4.0/gems/actioncable-5.2.7/lib/assets/compiled
  /usr/local/bundle/ruby/2.4.0/gems/activestorage-5.2.7/app/assets/javascripts
  /usr/local/bundle/ruby/2.4.0/gems/actionview-5.2.7/lib/assets/compiled
  /app/public/lib
  /app/public/lib
  /app/node_modules
  /usr/local/bundle/ruby/2.4.0/gems/popper_js-1.16.0/assets/javascripts
  app/assets/javascripts/maps.js:1:
    //= require jquery-ui/jquery-ui.min.js
  app/views/front_ui/index.html.erb:5:
    <%= javascript_include_tag('leaflet-fullHash.js') %>
...
(190 additional frame(s) were not displayed)

ActionView::Template::Error: couldn't find file 'jquery-ui/jquery-ui.min.js' with type 'application/javascript'
Checked in these paths: 
  /app/app/assets/images
  /app/app/assets/javascripts
  /app/app/assets/stylesheets
  /app/vendor/assets/images
  /app/vendor/assets/javascripts
  /app/vendor/assets/stylesheets
  /usr/local/bundle/ruby/2.4.0/gems/actioncable-5.2.7/lib/assets/compiled
  /usr/local/bundle/ruby/2.4.0/gems/activestorage-5.2.7/app/assets/javascripts
  /usr/local/bundle/ruby/2.4.0/gems/actionview-5.2.7/lib/assets/compiled
  /app/public/lib
  /app/public/lib
  /app/node_modules
  /usr/local/bundle/ruby/2.4.0/gems/popper_js-1.16.0/assets/javascripts
@jywarren
Copy link
Member

jywarren commented May 6, 2022

The line is

//= require jquery-ui/jquery-ui.min.js

@jywarren
Copy link
Member

jywarren commented May 6, 2022

It's odd, the trace also notes line 5 of index.html:

<%= javascript_include_tag('/assets/leaflet-fullhash/leaflet-fullHash.js') %>

I notice it's on a series of lines with absolute references, but it doesn't specify an absolute path. So just in case i updated it to match the others. I could imagine somehow it's initiating Sprockets by searching for the reference... long shot but who knows:

9bd04f7

@jywarren
Copy link
Member

jywarren commented May 10, 2022

So one thing is that this file - jquery-ui.min.js was added to get jquery-draggable as part of a 2014 project: https://github.com/publiclab/mapknitter/blame/b393e579db12eee02295c4392e1574c61ea10ee3/app/assets/javascripts/maps.js#L1

I think possibly we need to change how we include it, as there are lots of pages saying it's changed.

We can also just try removing that line, because it relates to "being able to drag images from the sidebar into the map" which isn't a critical feature and currently doesn't work!

@jywarren
Copy link
Member

jywarren commented May 10, 2022

Reopening, it failed with similar error on exif.js package. Checking that but also updating to node 16 LTS in meantime because:

the "The engine "node" is incompatible with this module." error that is, but... i dunno i never see it get to step [4/5] so maybe it is an issue after all?
where is node installed, could we work on the node version, just to eliminate this possibility?

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y npm

I looked at https://github.com/nodesource/distributions and found the v16 LTS and trying that on unstable

@jywarren jywarren reopened this May 10, 2022
@jywarren
Copy link
Member

Strangely pushing to unstable before upgrading to node 16 got Yarn to step 5/5 already https://jenkins.laboratoriopublico.org/job/Mapknitter-Unstable/331/console but I'm also watching it after the v16 update here: https://jenkins.laboratoriopublico.org/job/Mapknitter-Unstable/332/console

@jywarren
Copy link
Member

OK we are no longer seeing the yarn errors in any case. not sure if exif.js error will still happen on production though...

@sentry-io
Copy link
Author

sentry-io bot commented May 10, 2022

Sentry issue: MAPKNITTER-7C

@sentry-io
Copy link
Author

sentry-io bot commented May 10, 2022

Sentry issue: MAPKNITTER-7D

@jywarren
Copy link
Member

jywarren commented May 10, 2022

OK, for what it's worth, maybe I found an issue - the paths being checked don't include /node_modules/... -- but in stable/unstable, that seems to be where they're being unpacked. Is that config somehow getting skipped?

ActionView::Template::Error
couldn't find file 'exif-js/exif.js' with type 'application/javascript'
Checked in these paths: 
  /app/app/assets/images
  /app/app/assets/javascripts
  /app/app/assets/stylesheets
  /app/vendor/assets/images
  /app/vendor/assets/javascripts
  /app/vendor/assets/stylesheets
  /usr/local/bundle/ruby/2.4.0/gems/actioncable-5.2.7/lib/assets/compiled
  /usr/local/bundle/ruby/2.4.0/gems/activestorage-5.2.7/app/assets/javascripts
  /usr/local/bundle/ruby/2.4.0/gems/actionview-5.2.7/lib/assets/compiled
  /app/public/lib
  /app/public/lib
  /app/node_modules
  /usr/local/bundle/ruby/2.4.0/gems/popper_js-1.16.0/assets/javascripts

Strangely we did add /app/node_modules/:

- yarn_cache:/app/node_modules/

@jywarren
Copy link
Member

However, we are configured to load assets from /node_modules/ here:

config.assets.paths << Rails.root.join('public/lib')
config.assets.paths << Rails.root.join('node_modules')

@jywarren
Copy link
Member

Let's see. If the upgrade to node 16 above causes yarn to complete properly, maybe we are just OK here. If not, then we should try changing the yarn_cache path to /node_modules/, maybe?

@jywarren
Copy link
Member

I wonder if the inconsistency w MapKnitter stable/unstable was that we had partial collections of files in some other directory on the Sprockets search path... left over or something...

@jywarren
Copy link
Member

Question for later: why isn't yarn error triggering a build failure in CI?

@jywarren
Copy link
Member

Noting we broke map form location autocompletion as autocomplete() is part of jquery-ui. Will follow-up with a system test for this, but in meantime, reverting and re-adding jquery-ui in #1696

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant