I have been developing a small app with Sinatra. Locally it works fine but when I deploy it Heroku my JavaScript paths seem to break and I have no idea what is causing this.
My directory set up is I have a "assets" folder in the root of my application with separated folders for both scripts and styles. The scripts folder has a few subdirectories. I have set my public folder in Sinatra using:
set :public_folder, __DIR__ + '/assets'
My styles work correctly and I am drawing a blank on what the problem is. Also worth noting I am using requirejs to load my JavaScript.
Here is the output from the console:
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/jquery.js 404 (Not Found) require.min.js:1884
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/templating/hogan.js 404 (Not Found) require.min.js:1884
2
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.min.js:194
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/lodash.js 404 (Not Found) require.min.js:1884
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.min.js:194
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/pusher.js 404 (Not Found) require.min.js:1884
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror
Any help or a kick in the right direction would be great.
Thanks
You could run a console with the heroku toolbelt (something like heroku run bash --app <your app name>) and verify if you have your JS files up.
Greetings!
I'm not a Sinatra hacker, but I don't find any DIR in their docs. Try setting DIR to
File.dirname(__FILE__), which I do see in their docs
It would help if you posted the Sinatra code that renders the links to the javascript files (ie. haml views etc).
However, without the code, I have a feeling it may be because you should be using Sinatra's url helper. If that's not it, and you post your code, I'll take another look.
Related
I have a Laravel + Vuejs project and while everything works fine on local development, 2 pages are throwing the ChunkLoadError.
I have looked at other issues on SO, and checked my output path, file is really there.
Page is here : https://dev.trouveruncouvreur.ca/guide-toiture and same for https://dev.trouveruncouvreur.ca/city/d-soumission-couvreur-toiture-Brossard
Error is here :
The chunk is available if you click on the link https://dev.trouveruncouvreur.ca/js/blogs-component.js
Edit: I deleted the project from the dev server, and reinstalled everything without success. I keep having the same issue. I did install on another server I have access to, and the error is gone, pages are all served correctly. We just found out client on dev server is using Cloudflare, so once we have acces, we can delete cache and see how it goes.
In this case, Cloudflare's cache was the culprid. All vues files/chunk are now correctly served.
I'm attempting to implement push notifications in a reminder app I'm building. I am attempting to follow along to the way it is done in this demo project. To that end, I added a razor class library project entitled BlazorReminders.ComponentsLibrary to my BlazorReminders solution. Just as the BlazingPizza project did, I put the localStorage.js and pushNotifications.js files under the wwwroot folder of the ComponentsLibrary project. I then added a reference to the ComponentsLibrary in the client project and attempted to load the resources in the client's index.html file as follows:
<script src="_content/BlazorReminders.ComponentsLibrary/localStorage.js"></script>
<script src="_content/BlazorReminders.ComponentsLibrary/pushNotifications.js"></script>
This is the exact way they did it in the demo project, however for me it returned a "Failed to load resource: the server responded with a status of 404 ()".
A more detailed console message
GET https://localhost:44304/_content/BlazorReminders.ComponentsLibrary/pushNotifications.js net::ERR_ABORTED 404
I've also tried changing the src path to variations of "..\BlazorReminders\BlazorReminders.ComponentsLibrary\wwwroot\pushNotifications.js" to no avail; I got the same errors.
What could be causing the 404? Thanks
EDIT: Resolved
Thanks to agua from Mars for pointing out that I had forgotten to update the these package references in my ComponentsLibrary project file
//Version had to be changed to 3.2 preview
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.2.0-preview2.20160.5" />
I have an angular2 and play app from here. Everything works fine when I run it in dev mode with sbt run. However I would like to test the production, so I do sbt dist, load the app and get the following errors in console.
http://localhost:9000/assets/lib/rxjs/rx.js Failed to load resource: the server responded with a status of 404 (Not Found)
zone.min.js:1 Error: (SystemJS) Error: XHR error (404 Not Found) loading http://localhost:9000/assets/lib/rxjs/rx.js(…)e.invoke # zone.min.js:1
However when I click on the link I see that a file has been loaded.
Here is the code for system js configuration I am using. Does anyone hava an idea on how to fix this?
The problem was deprecated imports.
change
import { Observable } from "rxjs/rx"
to
import { Observable } from "rxjs/Observable"
in ts source files.
I've downloaded both JavaScript and TypeScript kit and followed Aurelia instructions for routing from the getting started page
The JavaScript example works fine but the TypeScript shows the following error on the console when the app is run:
Failed to load resource: the server responded with a status of 404 (Not Found)
ERROR [app-router] Error: XHR error (404 Not Found) loading http://localhost:8080/welcome.js
ERROR [app-router] Router navigation failed, and no previous location could be restored.
Does anyone have experienced the same problem?
Rob Eisenberg posted an answer to my issue I put up on github.
https://github.com/aurelia/beginner-kits/issues/12
He said to make sure the moduleId of the router looks like this ./welcome.
I'm trying to run a sample app by using cordovas camera plugin and I got an error, when trying to debug on chromes emulator
Failed to load resource: the server responded with a status of 404 (Not Found)
(http://localhost:8000/android/www/css/images/ajax-loader.gif)
The correct path is css/images/ajax-loader.gif
You are debuging your application in chrome emulator. But you are using the ajax-loader.gif placed in platforms/andoroid/www/css/images change the location of the loader to www folder in the root folder.
css/images/ajax-loader.gif.
In chrome emulator, the files in www folder in the root of project is taken.
Change the location of loader and check whether the problem is solved or not