I am trying to serve an ember app from IIS.
I created a new app using ember new my-app and then ran ember build --environment production. This generated the files in the dist directory as expected.
On the IIS side, I added a new website on the server and mapped the dist folder from the last step.
Now, when I navigate to localhost/index.html I get a blank page.
I checked the source of the page and the js files are being served correctly as expected. This would mean that it's the templates that are not being retrieved correctly. In the chrome inspector console there is an exception which says Uncaught: UnrecognizedURLError: /index.html. The ember inspector says 'Ember application not detected!'.
I've tried the solutions mentioned here, but none has worked for me.
Has anyone else experienced this problem/know how to fix this?
Ember Router uses location: history by default. This means, it assumes that /index.html is your route. But obviously it's not defined so the router throws UnrecognizedURLError.
There are several solutions for your problem:
Set locationType: 'hash' in config/environment.js of your ember application. This will force Ember router to use # in url for routing and in your case this would be like localhost/index.html#your/route.
Configure your IIS instance to handle index.html as a default document. To do this, open your server config and make sure it has the key:
Change ember build config to produce index.aspx instead of index.html. You can read about it here.
Related
I have this folder structure for my next.js project
/public
|static
-hello.png
|sample
-test.js
|charting_libray
|bundle
-dist.js
|hello.png
In my local environment
http://localhost:3000/static/hello.webp
http://localhost:3000/hello.webp
http://localhost:3000/static/sample/test.js
All of these works. This means JS, Image anything can be served from nested folders or directly from the public folder.
But when I build the project using next build command and deployed it to the production.
mydomain.com/static/hello.webp
mydomain.com/hello.webp
mydomain.com/static/sample/test.js
I have noticed only the images files can be accessed and the JS file returns 404.
My real-world use case is, inside a component I pass the path to a library like this
libraryPath: "/static/charting_library/"
I can see a net::ERR_ABORTED 404 error in the prod env browser console. Somehow the library works even with this 404 error.
But I need to know the reason for this 404 error and need to fix in the code.
Any help!
Thanks in advance.
I have a problem with overriding default template from app/Resources folder to my bundle resource folder. I have installed Aimeos Symfony bundle. And I get this error with opening list route. I moved all view files from app folder to bundle resource. Here is my folder structure project tree:
But i get this error trying to access /list route of Aimeos. I guess it has a wrong path main error:
Why are you "moved all view files from app folder to bundle resource"?
Please, carefully read the installation manual, especially this step - Symfony/Adapt base template.
So there was two ways how you got this error - you missed this installation step or just moved out app/Resources/view/base.html.twig that is important to see /list route.
Attempting to wrap my head around Ember.js.
Seems I understand the complex things, but miss out on the little things.
How would one go about adding an example.js file?
For simplicity, let's say the example.js file only contains:
(function(){
console.log("example is alive in console");
})(window);
This should display "example is alive in console" within the browser console.
I have tried:
adding app.import('vendor/javascripts/example.js'); within ember-cli-build.js and adding <script src="{{rootURL}}vendor/javascripts/example.js"></script> to index.html
Console is showing
ⓧ GET http://localhost:4200/vendor/javascripts/example.js
DEBUG: -------------------------------
DEBUG: Ember : 2.11.3
DEBUG: Ember Data : 2.12.1
DEBUG: jQuery : 3.2.1
DEBUG: -------------------------------
ⓧ GET http://localhost:4200/vendor/javascripts/example.js
All of the answers I have found stated that just adding custom.js to vendor file works. Sadly, I am missing something.
When modifying ember-cli-build.js you MUST RESTART the ember server manually. The livereload server will not pick up the changes.
This works for me when I don't nest assets in the /vendor directory. The ember-cli build process bundles JS files in /vendor into a single vendor.js file, which you can see linked in app/index.html. So place your example.js file at the root of /vendor, and then add the import to ember-cli-build.js:
app.import('vendor/example.js`);
Now when you start the server, your code from example.js should execute, since it will be included in assets/vendor.js.
Firstly, Ember.js has Convention Over Configuration approach, and your URL can do a lot of things than a normal HTML website.
Whatever you may want to do with your custom.js file it is not ember way of having it as a path. You need routes for navigation across the app. Although routes do much more than navigation. You specify the structure of your app that a user can browse through using Router's map function in app/router.js file.
However if you want to include custome.js file in your app, and have custom.js do some set of tasks for your app. You can simply go ahead and create a directory with any name, javascript for instance inside app directory. Have your javascript files placed inside it. Then you can import these files as simply as referencing any other files in ember:
import customObject from 'yourApp/javascript/custom.js';
Here, your custom.js should be exporting customObject.
Do read the guides if you want to learn more. And the API docs if you actually want to learn more.
Note: At the time of writing this answer current ember-cli version is #2.12.0
Hey guys am trying to learn sails.js, I have followed some tutorials where the sails.js application has "views" directory (by default) but my setup doesnot have one.
So I created a directory named it "views" inside project directory and then,
I created an index.ejs file with <h1>Hello World</h1> as content.
Configured the route '/': {view: 'static/index'},
Then I tried it in my chrome with localhost:1337 and nothing showed up in the browser, but in the terminal I got a chunk of error out of which I found it saying no such file or directory, open 'c:\project\views\layout.ejs'.
What is it that Iam missing?
It's expected there will be an app-wide layout file (named as what's missing).
Create or copy that file and things should be working again.
I have a Ruby On Rails App. I am using Cpanel on centos 6.4 with phusion passenger.
My app runs fine with all the controllers and models working okk.
The issue is , I have Stylesheets, JS and Images in a folder named public (generally it is).
I have included all of them in my app but i get following error with all of them.
No route matches "/javascripts/application.js" with {:method=>:get}
I am sure that all my files have correct path as previously when i use to use the app with mongrel, it use to work fine.
My .htaccess code is :-
RailsBaseURI /
PassengerAppRoot /home/crosstr/rails_apps/appname/public
My App specifications are :-
Ruby 1.8.7-p352
Rails 2.3.5
Any help will be appreciated.
Thank you
You might need to change this setting to true -
config.serve_static_assets = true
in the environment/production.rb file. It's false by default in production.
http://guides.rubyonrails.org/configuring.html#rails-general-configuration
Update
The above is Rails 3 only, my mistake.
PassengerAppRoot should point to the app root, and not public