Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

uninitialized constant Sprockets::DigestUtils in 0.9.9 #247

Open
monfresh opened this issue Aug 15, 2015 · 16 comments
Open

uninitialized constant Sprockets::DigestUtils in 0.9.9 #247

monfresh opened this issue Aug 15, 2015 · 16 comments

Comments

@monfresh
Copy link

Hi. I just upgraded to 0.9.9 and I'm getting this error during precompilation of assets:

uninitialized constant Sprockets::DigestUtils

This is because Sprockets::DigestUtils is only available in sprockets 3.0+, but due to version restrictions from another gem in my app, I can only use sprockets 2.x.

If requirejs-rails depends on a sprockets 3.x feature, then sprockets needs to be added as a dependency with >= 3.0.

@carsomyr
Copy link
Collaborator

@monfresh Hmm, I thought this got fixed recently with Sprockets 2.x backwards compatibility.

@agis
Copy link
Contributor

agis commented Aug 18, 2015

Stumbled on this too today, c7babb6 is the culprit.

@carsomyr What do you refer to by "Sprockets 2.x backwards compatibility"?

I think we would be compatible if we change the code as described here. What do you think?

@monfresh
Copy link
Author

Any updates on this issue?

@carsomyr
Copy link
Collaborator

@monfresh Could you check master?

@Chrisell
Copy link

Chrisell commented Dec 1, 2015

Also seeing this issue on 0.9.9 w/ sprockets 2.12.4. Same restriction @monfresh mentioned to being able to update sprockets.

@monfresh
Copy link
Author

@carsomyr Was this supposed to be fixed in 1.0.0? I'm still seeing the same error uninitialized constant Sprockets::DigestUtils.

@passabilities
Copy link

@monfresh I am getting the same error. 1.0.0 was supposed to fix a precompilation error I was running into.

EDIT: So it seems that DigestUtils is only available in Rails 4. I am running into this error because my project is running Rails 3.2.22

@passabilities
Copy link

Ok so I found a workaround for this using Rails 3.2.22 (didnt try for any other versions) and requirejs-rails 1.0.0.

If you just copy and paste DigestUtils.rb file into config/initializers, it will attach DigestUtils into sprockets and work correctly.

NOTE: the main thing that I had to do to get it to work is change the default pack_hexdigest method from
bin.unpack('H*'.freeze).first
to
bin.hexdigest

@carsomyr
Copy link
Collaborator

@passa763 Is there some problem with

bin.unpack('H*'.freeze).first

It seems to work for me.

@carsomyr
Copy link
Collaborator

Can y'all test the commit above? @monfresh @passa763 @Chrisell

@passabilities
Copy link

@carsomyr bin needs to be a string in order for unpack to work. But for me, bin is a <Digest::MD5> object.

EDIT: what Rails version are you using?

@carsomyr carsomyr reopened this Dec 31, 2015
@carsomyr
Copy link
Collaborator

carsomyr commented Jan 7, 2016

All, I'm working on a solution that everyone can use. Apparently there are some version inconsistencies to sort through as to which methods are and aren't available for use.

turpana added a commit to turpana/requirejs-rails that referenced this issue Feb 26, 2016
@fregas
Copy link

fregas commented Apr 21, 2016

I'm having this issue with rails 4.0.13 and requirejs-rails 1.0. I also tried requirejs master. Same problem.

@dhara-pyrumas
Copy link

I'm using Rails 4.2.4 and requirejs-rails 1.0.0. Getting same error, please help!

@carsomyr
Copy link
Collaborator

Does using master help?

@dhara-pyrumas
Copy link

I commented both sprockets and sprockets-rails, but when I run the command,

gem list | grep sprocket

o/p is,
sprockets (3.7.1, 2.12.4)
sprockets-rails (3.2.0, 2.1.4)

After commenting gems, I'm now able to run assets:precompile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants