I scaffolded a basic angular-php yeoman app to try it out.
angular-php
When I run grunt serve it works as expected and pulls some data using rest using $http.get('/api/features')....
When I minifiy the project it creates a dist folder which I assumed could be dropped onto a webserver so I dropped it onto XAMPP and browsed to localhost:8000/dist.
The site loads ok but it cannot find the api
localhost:8000/api/features not found
when I browse to localhost:8000/dist/api/features it returns the json so the api is functioning, so I changed the get url to $http.get('dist/api/features') only this time it says
localhost:8000/dist/dist/api/features not found
What am I missing?
Oops. Seems I forgot a /.
Should have been /dist/api/features
Related
Both the background image and navbar background don't render. I'm using Vercel and Netlify to deploy and have used the build command as well as the publish directory setup on both sites. Tried checking my code since I'm using Tailwind for the first time, but I still can't figure out what went wrong?
The repo: https://github.com/d4nky/Tailwindcss-Portfolio
The site: https://inspiring-carson-2c8f1d.netlify.app
Any piece of information would be appreciated :)
You have to put img directory in your dist too, because for now, you are using path /img/background.jpg which refers to repo /dist/img/background.jpg file, that doesn't exist.
You can check that in the console, which says:
GET https://inspiring-carson-2c8f1d.netlify.app/img/background.jpg [HTTP/1.1 404 Not Found]
And the same for logo_size.jpg.
You could put those directories directly to dist directory by hand, or use some bundling tool like webpack to automate things.
Because the site can't find the resources.
The links you specified in index.html are relative ones, the absolute path of which are path/to/index/ + value/of/src. For example your page will actually look for the main.js in repo-root/dist/dist/.
So you should either properly store and link your resources, or learn to use bundle tech, e.g. webpack.
this is my first time making a nodejs app, and using express. I created the project using create-react-app. I am trying to setup a CI/CD pipeline using VSTS to deploy to my Azure Web App. I am able to get my React code working on the web app, but when I try to hit my Express route, it throws a 404, and renders the index.html file instead of retrieving the data.
Here is my file structure: File Structure
My Package.json: Package.json
My Express server: server.js
Also, here is my build VSTS:
Archive
drop
And here is my Release:
Release
And this is what is put onto the server: Azure files
When I run this locally, hitting localhost/api/getData returns my data as expected. But for some reason it does not work in production.
Any help would be greatly appreciated! I've been stuck on this for the last 2 days and I can't seem to find anything that has helped. I've read multiple forums, but none of the fixes they provide seem to be working. Thank you!
When testing locally my create-react-quiz app works perfectly. I was basing my project off of this code: https://github.com/mitchgavan/react-multi-choice-quiz/tree/gh-pages.
However, when I use npm build deploy on my "GitHub-Pages" branch, a blank page shows up and these errors show up in the console:
pk8189.github.io/:1 GET pk8189.github.io/pk8189/futureU-/static/css/main.1dc4d41f.css
pk8189.github.io/:1 GET pk8189.github.io/pk8189/futureU-/static/js/main.28e294a0.js
This is my repo: https://github.com/pk8189/futureU-
What do you think the issue is? Thank you for any help.
Create React App uses homepage field in your package.json to determine the URL at which the app is served. Since you set it to https://github.com/pk8189/futureU-/, it tries to request assets from /pk8189/futureU-/ which doesn't exist.
Change homepage to match your deployed URL: https://pk8189.github.io/futureU-/. Then rebuild by running npm run build and re-deploy.
This is described in deployment instructions for GitHub Pages. Please read this part of the User Guide.
I have created a simple application using Create-React-App (CRA). The problem is that even though the app runs perfectly fine on my localhost (ie, after using npm start), when I try to publish my pages to gh-pages (npm run build, and npm run deploy), I am not able to load the page using the URL. I don't even see any errors in console at first, but after a while (or more specifically, after I open the Timeline tab in console), I see the following error.
Failed to create temp file 18 : It was determined that certain files
are unsafe for access within a Web application, or that too many calls
are being made on file resources.
I do see this warning on my local dev environment,
[Violation] Long running JavaScript task took 229ms
and the minified bundle.js file goes to about 4MB in size. But I guess this is not the issue because my other projects have the same warning and they are published just fine.
I'm also fairly confident that this is a more JavaScript related issue, rather than CRA related. I read somewhere that this might be a network mapping of resources issue. But so far, I'm not really sure what this means or how to resolve it.
Just to answer my own question, in case anybody else lands up here.
The issue was in the way I was using react-router. I was initially using browserHistory instead of hashHistory.
As per the docs,
GitHub Pages doesn’t support routers that use the HTML5 pushState
history API under the hood (for example, React Router using
browserHistory). This is because when there is a fresh page load for a
url like http://user.github.io/todomvc/todos/42, where /todos/42 is a
frontend route, the GitHub Pages server returns 404 because it knows
nothing of /todos/42.
More information can be found here.
So I made a Typescript project with Visual Studio. It works fine when I launch it with Visual Studio, but if I try to push it to my GitHub Pages site, it will put the index.html in a subfolder and I get a 404 error when I try to load my website. Even if I try to reference the index.html in the website url it doesn't really work.
I was wondering if it's possible to only publish the needed items. I think I would only need the subfolder. Correct me if I am wrong though.
Note: I have the GitHub extension for Visual Studio installed.
UPDATE:
Since some of the links don't seem to work anymore I think I should give some extra information. So basically you need to have a branch named gh-pages. On that branch you need to have an index.html file in your root folder. Then the index.html file should be visible on the github page URL.
You need to push a branch named gh-pages in order to view it as a website.
Create a new branch and then move the file into the root folder of the branch, upload it to the gh-pages and you set to go.
Check this out:
https://github.com/nirgeier/JimVliet.github.io/tree/gh-pages
This is how your file should be inside your root folder.