Play 2x webjars deploy to heroku failed - heroku

I tried deploying the standard angular-play-seed project, which uses angularjs and requirejs webjars to heroku.
However, on heroku it throws an error because it cannot find require.js
Failed to load resource: the server responded with a status of 404 (Not Found)
Trying to fetch requirejs from the URL
/lib/requirejs/require.js
Update:
Thanks for the suggestion James, yes I am able to recreate this locally in activator clean start.
I'm pretty sure some configuration in my sbt-rjs is messed up but I don't know what.
This is what my folder structure looks like
public
/ui
/js
/myApp
/controllers.js
/services.js
/main.js
/paritals
/myApp
/partial1.html
I see this error both during activator start and sbt stage.
[info] Error: Error: /home/sajit/angular-play-seed/target/web/rjs/appdir/./main.js does not exist.
The scala.html page which launches the angular app, myApp has this
<script data-main="#routes.Assets.versioned("ui/js/myApp/main.js")" src="#routes.Assets.versioned("lib/requirejs/require.js")"></script>
What am I doing wrong?

Based on the sbt-rjs docs it looks like you need to set the appDir in your build.sbt, like:
appDir := "ui/js/myApp"

Related

I've got an issue with using 'visit'

When my Cypress tests are run on Github (headless).
When I call visit('/page') - get a 404 error. The page definitely exists.
CypressError: 'cy.visit()' failed trying to load:
http://localhost:4200/page
I can run the same tests locally (headless and headed) and they work fine.
Anyone have any ideas why this could be?
I should add that this is an Angular Application and there are no 404's because all routes are handled with wildcard. I know this page exists and happens if i try to visit another page that exists.
Version:
"cypress": "^10.6.0",
This is the .yml file. The baseUrl is set to 'http://localhost:4200' in the 'integration.config.ts' file.
So found the answer.
We are serving the Angular application with 'http-server'. It was only recognising the route '/' and was returning a 404 for any other app routes / pages.
We fixed this by adding --proxy http://localhost:4200? to the http-server command.

Laravel Vue.js components are not working on server

I am new to Laravel Vue and I recently came to a project. at my localhost everything working fine, but when I pushed my project to the server via git, the Vue components not working. it says this error in the console...
Uncaught SyntaxError: Unexpected token '<' app.js:1
there is no npm install on the server so I run the command locally "npm run production" and pushed the app.js and all other js files via git to the server.. the server files are the same as localhost but Vue components not working on the server, but they are running on localhost..., I am stuck to the problem with 3 days, any help will be highly appreciated.
Thanks
Just for clarity, the CSS file is rendering but the JS file not
In my console:
Resource interpreted as Stylesheet but transferred with MIME type text/html: /rider/auth/public/css/app.css.
Uncaught SyntaxError: Unexpected token '<' app.js:1
So the issue was in the .env file , and there was a variable "ASSET_URL = ./public" , this was not allowing the application to go to the correct path . Thanks #Aless55 for your great support

How to deploy reagent-frontend to Heroku?

I created a ClojureScript Reagent app from template reagent-frontend. How I can deploy production app to Heroku? After building for production (lein package / lein cljsbuild once release) leiningen generate app.js in folder public. As result public folder contain css/, js/, index.html.
On my attempt push folder public Heroku give next error:
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
Heroku can serve PHP so one way to go about it is by adding an index.php file to public with the following content <?php header( 'Location: /index.html' ) ; ?> This will serve your own index.html. Then push that to Heroku.
Source: https://blog.teamtreehouse.com/deploy-static-site-heroku

Rails: application.css not in asset pipeline

I know this is a old question but no answer is fixing my problem.
I'm new to Ruby on Rails and just created project with a PostgreSQL database just to be able to upload the project to Heroku.
When i start the rails server im getting the error "application.css is not present in the asset pipeline."
I'm using bootstrap 4 gem and this requires that you rename the applications.css to application.scss.
I dont know what is wrong.
I really tried every answer that is on stackoverflow without any success :(
Please help me, what am i doing wrong?
This is the error im getting:
Ok, first thing.
Do you have config.serve_static_files = true set in your production.rb file under config/environment folder.
Since we run behind NGINX, in our case it looks like config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
Second thing. Did you do rails assets:precompile before the uploading it to the server?
And the third thing is. Have you tried calling your file application.css.scss, and redoing the rails assets:precompile?
Last, and not least thing. How does your application.scss file look like?
Did you remove all those *= and used #import instead for Bootstrap
It is nicely described in the documentation:
Import Bootstrap styles in app/assets/stylesheets/application.scss:
// Custom bootstrap variables must be set or imported before
bootstrap. #import "bootstrap";
And then it says:
Make sure the file has .scss extension (or .sass for Sass syntax). If
you have just generated a new Rails app, it may come with a .css file
instead. If this file exists, it will be served instead of Sass, so
rename it:
$ mv app/assets/stylesheets/application.css
app/assets/stylesheets/application.scss Then, remove all the *=
require and *= require_tree statements from the Sass file. Instead,
use #import to import Sass files.
Do not use *= require in Sass or your other stylesheets will not be
able to access the Bootstrap mixins and variables.
Read more here
origin answer
in my case, I forgot to install yarn command in my server.
so, please install yarn before running rails server. otherwise assets:precompile will do nothing and give no warning.
update
also, make sure all of these things:
file exists: app/assets/stylesheets/application.css
its content looks like:
/* ...
*= require_self
*= require_tree .
*/
also check file app/assets/config/manifest.js,
//= link application.css
To give more clarity to mutantkeyboard's answer
I had this issue when deploying a Rails application as a docker image that would run in a docker container without a web server like Nginx.
Here's how I got it fixed:
This issue is primarily caused in production when you do not want to serve your static files from the /public folder using a web server like Nginx or Apache.
To serve files your static files from the /public folder without using a web server like Nginx or Apache, do the following:
Ensure you precompile your assets using:
bundle exec rails assets:precompile
OR
rails assets:precompile
This will compile your assets into the /public folder
Next, in your config/environments/production.rb file, add the following:
Instead of this:
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
Use this:
config.public_file_server.enabled = true
This allows rails to serve the static files instead of a web server
Note: For improved performance it's best to serve the static files using a Web server like Apache or Nginx.
Just reinstall yarn et precompile our assets:
yarn's parkages don't push on github... to fix this, reinstall yarn:
yarn
and precompile assets:
bundle exec rails assets:precompile
Rails 7.0.4 ruby 3.1.2 I solved issue with yarn build when missing application.js but in case missing application.css just did yarn build:css

gulp build/firebase deploy won't transfer images or videos

I am trying to deploy my application, which works fine locally. When I use gulp build it says I have all of the files I need. When I do firebase deploy it says that everything uploaded. However, when I use firebase open it makes
it gives me the following 404 errors.
Here is what comes up when I do gulp build and firebase deploy
I can send the gulp-babel.js file upon request. Thanks in advance for looking.
If I am understanding you correctly, you are having a problem with your gulp-babel.js file. The gulp imagemin plugin is probably what you need.
https://www.npmjs.com/package/gulp-imagemin
Then somewhere in that file make sure you are creating something like this.
gulp.task('images', () => {
return gulp.src('app/images/*')
.pipe($.imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}]
}))
.pipe(gulp.dest('dist/images'));
})
See this if you have gulp-load-plugins: gulp-load-plugins not loading plugins

Resources