Can't push my project to Heroku…rake aborted Sprockets file not found

喜你入骨 提交于 2021-01-28 08:01:34

问题


so i'm trying to push my project onto Heroku but I keep running into this issue.

I've tried various different options and it still giving me the same error

The error is:

remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: Yarn executable was not detected in the system. remote: Download Yarn at https://yarnpkg.com/en/docs/install remote: I, [2018-07-11T15:38:38.244799 #1469] INFO -- : Writing /tmp/build_3216acb17a7c6513d0bbba80e51b87ec/public/assets/America_Latina_red.svg-81715f166cd02474df00ef6b91e8b614eee8c4b849a497d4b3d5f548b83fcd59.png remote: I, [2018-07-11T15:38:38.263447 #1469] INFO -- : Writing /tmp/build_3216acb17a7c6513d0bbba80e51b87ec/public/assets/magnifyingglass-f96713ba24099755cdd1bb1bb92c720b1136c87a85f437489a8cdb47e0f272af.png remote: rake aborted! remote: Sprockets::FileNotFound: couldn't find file 'bulma-start/_javascript/main.js' with type 'application/javascript' remote: Checked in these paths:

it says Sprockets:FileNotFound... everything is working locally. Also I'm using RoR


回答1:


It looks like you have node dependencies so you're application should be running multiple buildpacks (ruby and nodejs). Here's how to define them using Heroku CLI:

heroku buildpacks:set heroku/ruby
heroku buildpacks:add --index 1 heroku/nodejs

git push heroku main

Find more details here: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app




回答2:


You're referencing bulma-start/_javascript/main.js somewhere, but that file does not exist. Remove the bad reference.




回答3:


My /node_modules were inside my .gitignore. I removed node modules from .gitignore then in my terminal did:

RAILS_ENV=production bundle exec rake assets:precompile

then did git add .
git commit - m "my message"
git push heroku master

That's why when heroku was precompiling it was getting an error.



来源:https://stackoverflow.com/questions/51289793/cant-push-my-project-to-heroku-rake-aborted-sprockets-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!