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

getting "Sprockets::FileNotFound in Home#dashboard" error suddenly on localhost #4849

Closed
shubhscoder opened this issue Feb 18, 2019 · 43 comments
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute stale

Comments

@shubhscoder
Copy link
Contributor

shubhscoder commented Feb 18, 2019

Suddenly I dont know what happened but I am unable to load any page on localhost because I am getting the above error.I have attached a screeshot of the error. Thank you so much!

error_load

Update

See below for yarn install and yarn update to resolve this

@grvsachdeva grvsachdeva added help wanted requires help by anyone willing to contribute inspection bug the issue is regarding one of our programs which faces problems when a certain task is executed labels Feb 18, 2019
@sashadev-sky
Copy link
Member

@shubhscoder its the bootstrap file it specifies I haven't figured out how to fix it though. For me I can run my localhost but all my pushes to unstable fail

@grvsachdeva
Copy link
Member

Copying @cesswairimu's message from Gitter channel :

After pulling master yesterday I have been getting this error Sprockets::FileNotFound in uncommenting jquery in app/assets/javascripts/application.js seems to solve it. Is there anyone else experiencing this?

@sashadev-sky
Copy link
Member

it worked for me locally (localhost) when I ran yarn install and yarn upgrade but I don't really understand why it would work locally but not with a push to unstable

@grvsachdeva
Copy link
Member

I ran the same commands some days back for resolving this issue. We can see unstable's build log to find if the yarn install is running or not?

@sashadev-sky
Copy link
Member

https://jenkins.laboratoriopublico.org/job/Plots-Unstable/497/console
it says it runs but is using cache?

@grvsachdeva
Copy link
Member

That's the issue!

@sashadev-sky
Copy link
Member

I cleared cache a bunch of times is there a way to set it so that jenkins stops using cache

@grvsachdeva
Copy link
Member

I found this - https://stackoverflow.com/questions/35594987/how-to-force-docker-for-a-clean-build-of-an-image and let's see if it work or not

@cesswairimu and @shubhscoder you can resolve this issue locally by running commands as mentioned by sasha -#4849 (comment) .

@Souravirus @icarito any hint about this issue?

Thanks!

@shubhscoder
Copy link
Contributor Author

shubhscoder commented Feb 18, 2019

Thank you so much @gauravano !

  1. yarn install
  2. yarn upgrade
    worked on the localhost.

@grvsachdeva
Copy link
Member

@sashadev-sky unstable is back to normal.

@grvsachdeva
Copy link
Member

I just force pushed the master branch on unstable and it's back to normal. You tried the force push, Sasha?

@grvsachdeva
Copy link
Member

Here's the passed build log - https://jenkins.laboratoriopublico.org/job/Plots-Unstable/499/console
this build also shows the use of cache for some commands but I guess cache wasn't a problem as yarn install and yarn upgrade ran normally

the link I posted here resulted in this build - https://jenkins.laboratoriopublico.org/job/Plots-Unstable/500/console

@grvsachdeva
Copy link
Member

@sashadev-sky
Copy link
Member

@gauravano it just started working for you by using --force? It could just be my computer setup

@sashadev-sky
Copy link
Member

@gauravano is bower still required for proper installation at this point?

@sashadev-sky
Copy link
Member

@gauravano nevermind mine worked!

@grvsachdeva
Copy link
Member

grvsachdeva commented Feb 18, 2019

@gauravano it just started working for you by using --force? It could just be my computer setup

I always force push on unstable. I doubt that computer setup has anything to do in it. You can check the changes of your push and see if that's incorrect. I would advise you to use force push too on unstable as I can see that you have to struggle a lot with unstable in recent hours.

We use yarn with plots2, right?

@Souravirus
Copy link
Member

Did it work? I guess force push was needed because I have changed the bootstrap3-typeahead to typeahead.js for Bootstrap 4. That's why it might not be working.

@grvsachdeva
Copy link
Member

yes @Souravirus, it worked out after force-push. Thanks for checking in :)

@sashadev-sky
Copy link
Member

@gauravano @Souravirus yes that was a struggle! I just got a new laptop so it could have been computer related for me, but I had been force pushing the whole time so that was not the solution for me.

What led to it working was re-installing my Homebrew configurations for Docker and building and a docker container. Are we supposed to be building containers before pushing to unstable?

@Souravirus
Copy link
Member

@sashadev-sky I don't use Homebrew, so, I don't have any idea about that.

@grvsachdeva
Copy link
Member

I don't use homebrew or docker locally too.

@icarito
Copy link
Member

icarito commented Feb 19, 2019 via email

@jywarren
Copy link
Member

Thanks for responding here and debugging so much! I wonder if this was linked to the yarn.lock and package.json updates I made recently. This has helped us get our JS dependencies much more up to date, but maybe it had an unintended consequence -- if so, apologies!

Does running yarn install help folks here?

@jywarren
Copy link
Member

Also noting that this could.... maybe... be related: #4853

@jywarren
Copy link
Member

@cesswairimu how are you doing on this?

@sashadev-sky
Copy link
Member

@icarito I don't know too deeply about docker setup, I only learned how to build a container recently because I thought I needed it for the unstable branch. The 2nd occasion I used unstable I ended up building it again because of the sprockets errors and using it the 1st time inadvertently had worked for me. Then sprockets error was resolved.

Without using the container the issue is coming up for me again. But in my local environment it is gone after doing yarn install and yarn upgrade once.

@icarito
Copy link
Member

icarito commented Feb 20, 2019

What happens if we simply not mount /app as a volume? In theory this is only needed if the application writes to the filesystem. Do uploads go to a specific dir? If it is the case, we could mount a directory for uploads instead of the whole app directory (at https://github.com/publiclab/plots2/blob/master/containers/docker-compose-production.yml#L41 )

@icarito
Copy link
Member

icarito commented Feb 20, 2019

Perhaps mount /app/public/system as volume instead of all of /app - i'll try it in a pull request and we can tests it in unstable. Thanks for the info and help debugging!

@sashadev-sky
Copy link
Member

@icarito sorry I am trying to follow but I am little confused. This is my understanding please help fix it if you can:

  1. when I run docker build on the repo, the docker loads my local settings from my host daemon.
  2. Then because of app being specified as a volume, it overrides my local settings with those of app
  3. app is just the local plots2 repo I have on my computer
  4. so it creates a plots2 image of my repo at that moment in time. and this build succeeds. Which makes sense because I am also able to run app in localhost successfully
  5. if all of this is the case, then what am I sending to Jenkins before building the image that causes it to fail? and what am I sending after that is different?

@jywarren
Copy link
Member

But in my local environment it is gone after doing yarn install and yarn upgrade once.

This is great to hear, and perhaps we just need to add better docs on running these to resolve this issue?

The Docker config discussion sounds important too, but for those just arriving, the yarn install and yarn upgrade solution seems to resolve this. Thanks, all!

@Souravirus
Copy link
Member

Hi everyone,
If the unstable build is failing due to this error: Sprockets::FileNotFound: couldn't find file 'bootstrap-3-typeahead/bootstrap3-typeahead.min.js' with type 'application/javascript'. Then you can remove this asset from app/assets/javascript/application.js. This fix is working for now.

@jywarren
Copy link
Member

jywarren commented Mar 4, 2019 via email

@Souravirus
Copy link
Member

Souravirus commented Mar 8, 2019

Hi @jywarren, I think that there is some problem with the yarn.lock which isn't being updated after adding or removing a package. I guess removing the yarn.lock from the .gitignore file might work because I guess the result of the changes in the package.json might not get updated in the yarn.lock. That's why when I deleted the typeahead package from the package.json, everyone's build failed in unstable after that.

The same problem happened to me today. The bootstrap that was installed at first was bootstrap 3 and then when I sent a commit later it was then updated to Bootstrap 4.

@sashadev-sky
Copy link
Member

sashadev-sky commented Mar 8, 2019

@Souravirus I have noticed inconsistencies between them too, but there is a copy of yarn.lock in the remote repo? I think the configuration set up for yarn could be problematic, let me know what you think:

.yarnrc has the following:

--install.modules-folder "./public/lib"
ignore-scripts true
ignore-engines true

which is saying we configured yarn so that it does not run any scripts from package.json. But when we run yarn install, it runs the postinstallscript in package.json anyway. And the postinstallscript creates symlinks to a bower components folder (which i think we definitely should remove if we are not using bower anymore). Yarn upgrade however ignores the script. Is that the behavior that was expected when it was set up?

@sashadev-sky
Copy link
Member

and also in package.json we put yarn as an engine, yet in .yarnrc we have --ignore-engines

@Souravirus
Copy link
Member

Hi @sashadev-sky, the ignore-engines is done to tackle this incompatibility error:
[email protected]: The engine "node" is incompatible with this module. Expected version "0.8.x" which was being removed with this --ignore-engine options following this link.
Also, there was some error with the phantomjs, which were removed by the --ignore scripts.
Here is the full error.
So, I think these scripts were required at the time installation.

@sashadev-sky
Copy link
Member

@Souravirus hmm I don't know much about best practice for yarn setup, just pointing out behavior I thought was strange. But since bower is deprecated I definitely think we should remove or change the current postinstall script. Not a huge deal but don't need those extra symlinks. Perhaps a quick change just to make if you're already playing around with yarn in a PR

@sashadev-sky
Copy link
Member

@Souravirus also I found the postinstall script to be really useful for debugging if you put a throw e and a conditional of your choice in there. Maybe you will know what to check for to fix your problem :)

@Souravirus
Copy link
Member

Yeah, I think the postinstall script should be removed for now. If you can send a PR for it, then it would be great.

@sashadev-sky
Copy link
Member

@Souravirus will do

@sashadev-sky
Copy link
Member

@Souravirus opened an FTO for this via #5037

@cesswairimu
Copy link
Collaborator

Run yarn install and yarn update to resolve this.
Thanks all

@publiclab publiclab deleted a comment from stale bot Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute stale
Projects
None yet
Development

No branches or pull requests

7 participants