polymer serve with components - polymer

I have been facing issues with the polymer-cli since I installed it. I am not able to serve components during development. I have to write my own Node.js server with remapping urls to work with components. But the documentation page clearly suggests that it had already done this work with its own tool.
What I did
Create a component using polymer-cli's polymer init
Serve the component using polymer serve
The result is unexpected and caused the following errors:
Polymer version: 0.18.0-pre.15
Ubuntu 16.04.2 LTS x64
On running polymer serve
info: Files in this directory are available under the following URLs
applications: http://127.0.0.1:8081
reusable components: http://127.0.0.1:8081/components/test-element/
A) If I try to open localhost:8081
GET http://localhost:8081/webcomponentsjs/webcomponents-loader.js 404 (Not Found)
GET http://localhost:8081/iron-component-page/iron-component-page.html 404 (Not Found)
B) If I try to open `localhost:8081/components/test-element/demo/
The url redirects to http://localhost:8081/home/user-name/project-root/test-element/
The index page in the project root directory is served.
GET http://localhost:8081/home/user-name/project-root/webcomponentsjs/webcomponents-loader.js
GET http://localhost:8081/home/user-name/project-root/iron-component-page/iron-component-page.html 404 (Not Found)

Related

switching from bower_components to node_modules crashes Polymer project

I have a working Polymer project when I have all my links pointing to the bower_components folder, however, when I change to node_modules I get the following message when I run
polymer serve
"Failed to load resource: the server responded with a status of 404 (Not Found)"
with the URL being:
http://127.0.0.1:8081/node_modules/#polymer/polymer/polymer.html
This is correct since the Polymer team changed polymer.html to polymer.js
However, where is this done and how can I use polymer using yarn (which saves in node_modules)?
Edit:
I think I found the culprit. When I tried to find iron-icons (mind the 's'), I could only find it on yarn which saves to node_modules. When I load the node module iron-icons I get the above-mentioned error message.
So I point to the bower_component iron-icon (mind you, no 's') but that doesn't provide the extensive library of icons I have with the yarn package:
on Yarn: https://yarnpkg.com/en/package/#polymer/iron-icons
but no such thing with Bower: https://bower.io/search/
Why?!

polymer 404 on actualise (F5) on server only (working on local)

I'm new to polymer. I followed the starter kit and created some pages. On my PC localhost, everything works fine. But once deployed to the server, I've got the following problem :
- I can access the site
- I can navigate between my different pages
- but if I try to access directly to a page or if I actualize my browser page when navigating : I get a 404
I don't underdstand why.
Do you have any idea ?
my case : www.tora-photo.com -> works
http://tora-photo.com/gallery/mist -> 404 but can be accessed from the previous url
thanks a lot for your help
the solution : use use-hash-as-path in app-location and add hash to href source
Your server needs to redirect all paths to your index.html which is actually handling your routing. The server is returning a 404 because you don't hactually have a file file called index.html in the /gallery/mist/ folder from the root of your web servers base.

bootstrapped jekyll project fails to load its auto-generated css

I've created a new jekyll project precisely following the simple command sequence at https://jekyllrb.com/. However it seems like the server is not looking for the right main.css:
GET http://example.com/css/main.css 404 (Not Found)
This error in the browser console seems to imply an irrelevant domain for a local project, so I wonder whether those instructions just mentioned are not what one should do for bootstrapping and running/testing a jekyll project on your local server. In that case, what is the right procedure for working locally? and is there an automated command for setting a different host name for deploying to a real server?
I am using a fresh install of jekyll 3.2.1.
Thanks!
Dirty temporary patch (because of this issue).
In _config.yml, set url: http://matanster.github.io/bloglike or wathever is your production url.
Create a config_dev.yml and add url: http://127.0.0.1
Locally, you can serve with :
bundle exec jekyll serve --config _config.yml,_config_dev.yml

Polymer Starter Kit - ERR_FILE_EXISTS when trying to enable service worker

I am trying to follow the instructions from here to enable offline support (Service worker) in my polymer starter kit clone.
However, after making the changes in gulpfile.js, index.html and elements.html, I keep getting the following error whenever I refresh the page.
Also if I change the throttling setting to offline in Chrome Developer Tools and refresh, the page comes back with the "Unable to connect to the Internet" message so clearly the caching isn't working.
Is there anything else that I need to do?
Update: Just decoded the url (i.e. http://localhost:5000/bower_components/platinum-sw/platinum-sw-register.html&clientsClaim=true&skipWaiting=true&version=1.0) in the error message and ran it in Chrome and got a 404 error. If I remove everything after .html then the file can be found though.
I was having the same issue and turned out it's because the platinum-sw-cache is set to disabled in the dev development, which means service worker will not work if you run
gulp serve
So to test the PSK offline, you need to call
gulp serve:dist
You can also ignore that ERR_FILE_EXISTS error as explained by #pirxpilot.

Subdirectories in openshift project cannot be found

I built a site using a php openshift project and accessing the root directory via http works fine. However, all the root directories give me a 404 not found, like this one: http://test.toppagedesign.com/sites/
I checked with ssh, and /app-root/repo/sites and app-deployments/current/repo/sites/ both exist.
EDIT
Added a directory called php and now I have 503 errors for everything...
EDIT 2
I deleted the php directory, now the 503 errors are gone. However, I do still get 404 errors for the subdirectory.
Here is my directory tree: http://pastebin.com/hzPCsCua
And I do use git to deploy my project.
php is one of the alternate document roots that you can use, please see the March Release blog post here about this (https://www.openshift.com/blogs/openshift-online-march-2014-release-blog)
As for the sub-directories not working, can you ssh into your server and use the "tree" command to post the directory/file structure of your project? Also are you using Git to deploy your project or editing files directly on the server?
You need to have an index.php or index.html file in any directory that you want to work like app-domain.rhcloud.com/sites , if you just have sub-directories, how would it know what to show? Also, indexing (showing a folders contents) is not enabled for security reasons, and I believe there is no way to enable it.
This sounds like it could be a problem with how you are serving your static content.
I recently created a new sample app for OpenShift that includes:
a basic static folder
an .htaccess file (for serving assets in production)
support for using php's local server to handle the static content (in your dev environments)
Composer and Silex - a great starting point for most new PHP apps
You can serve the project locally if you have PHP-5.4 (or better), available in your dev environment:
php -S localhost:8080 -t static app.php
For a more advanced project that is built on the same foundation, take a look at this PHP+MongoDB mapping example. I wrote up a blog post with some notes on my process for composing that app as well.
Hope these examples help!