404 On NextJs Static Files - iis

I have a next js project that works fine with npm run dev.
it also works fine with npm run build and then npm start
it also works fine on localhost on the server.
but no css, or images, or any files works when it's on the domain.
I'm running it on IIS, windows server 2019 with plesk panel

Have you checked if the Request URL is correct?
It might be the issue regarding relative path / absolute path.

Related

next dev server only serves html (no scripts or assets, replicated with stock create-next-app)

To replicate my issue, I created a next app template folder with
npx create-next-app
(Version 13.1.6==latest, all default options, Node v18.14.0==LTS)
and when I try to run it with
npm run dev
it loads HTML files like index.tsx, but 404s on all assets and scripts.
The same thing happens with npm run build/start.
Reproduced the issue on both Chrome and Firefox
(no extensions or adblockers of any sort)
with create-next-app#latest and #12.4.3.
The issue does not reproduce on Docker though (node:alpine-current).
network tab
console tab

iis facturascript routing bootstrap css

i have try to install facturascripts in a windows server, server it´s working fine with many websites in php with laravel, wordpress, .... but when i try to put facturascripts in a domain it doesn´t work, i have translate .htaccess to a web.config file, but still not working.
i think the problem is with routing system, so i execute composer install and npm install to be sure everything is ok, but still nothing. bootstrap css and js files gives error 404, but the route chrome gives me is correct.
someone has facturascript 2020 working in IIS??
Check that the NPM dependencies have actually been downloaded in the node_modules folder. I recently saw a case that npm install failed on a Windows machine.
Here is the FacturaScripts official website with documentation to answer these questions.

I can't start my NextJS js app using plesk

I'm trying to start a NextJS application on my Node server using Plesk but it is not working. I activated NodeJS for my Plesk environment, and I was able to run npm install and npm build, but now, when I try to start the application, Plesk only shows "Please wait" and stays like that with no change, I have been waiting for more than 2 hours now, but I don't get any results, no errors, nothing.
The only issue I can think of is that, according to what I could find, the Application startup file and the package.json file should be in the same directory, the root folder, but in my case this is not possible. I have my package.json in the root directory, but the startup file for NextJS, index.js, is inside the pages folder. I tested building and starting the app locally and everything works fine, I don't understand why it's not working with Plesk.
I was able to fix this after correcting the startup file, it should be "node_modules/.bin/next" and not "pages/index.js".
Also when you start your app, Plesk will tell you to wait. Just check the site and make sure it is running, if it is, you can close Plesk.
You might need to install Express in your Next.js
You may refer to this repo fmi # https://github.com/zeit/next.js/tree/canary/examples/custom-server-express
If you're referring to the package.json's command we'll have:
dev
build
start
In Plesk's Node Application extension.
Website & Domains > "Your Domain" > Enable Node.js
Simply set server.js as my Application Startup File.
Ensure that all dependencies is installed using "Npm Install" helper.
You must run build command before start command.
Screenshot:
Helpful NPM/Plesk reference:
Running scripts in Node.js Application
Adding .npmrc file in Node.js Application Root folder

Which files from Node.js app must be uploaded to a web-hosting?

Perhaps this is a silly question. It came out while I was learning how to set up a Node.js application for production on Ubuntu and digital ocean.
Let's say I have a simple data visualization app made in Node.js, using node modules such as express, page, axios, yo-yo, and browserify to compile my files.
I want to upload my app to a webhost that already exists.
This is the structure's app:
node_modules
public (app.js and app.css)
src (header, home, and footer folders)
views (index.pug file)
gulpfile.js
index.scss
package.json
server.js
Which files I need to upload in order to see my app as I see it in localhost?
You need to upload everything.
What Maximelian says is true if you're going to run npm install again on your server. The standard way of doing this is sync the project using git (you can find a .gitignore template for node.js here).
Once setup you'd do something like this on the server after making the commit locally, and pushing to your remote git repo:
git pull
npm install
npm start
If you were to just ftp the full working project including node_modules it would work just by running npm start. But the above method is what I'd recommend.
If I remember correctly everything except node_modules, if you did not customized them. (rewrite some behavior after module installation)

Getting 'Cannot GET /' when trying to connect to localhost:5000 Firebase

I am trying to get my localhost server on Firebase to work but I am continuing to get the following message in the browser 'Cannot GET /'. I took a look in the console and all it says is 'http://localhost:5000/ 404 (Not Found)'.
I have tried re-running the server using 'firebase serve' and that doesn't help.
I ran 'firebase init' again and that didn't help either.
I re-installed the firebase tools by running 'npm install -g firebase-tools' and then running firebase serve again and still nothing.
Not sure whats going on because it was initially working. I installed some grunt plugins and moved my index.html file under an html folder although I still have an index.html file under the public folder it still says 'Cannot GET /'
I have also tried in different browsers restarting them etc.
I am using a Mac OS X El Capitan.
Let me know if you need any more info. Thanks in advance
I had this issue running firebase serve from within the scripts directory in the "Friendly Chat" tutorial. Starting the server from the parent directory got it working again as expected.
if this will help someone save time.. a possibility: it could be that the build step did not complete, this was my case, and the build/... directory had no index.html
I had the same issue when was trying to serve an Angular application with the firebase command.
Firstly, you should see the firebase.json file.
It should contain the "public" value, like:
{
"public":"dist/ProjectName"
...
}
But the dist folder will be auto created only after you build the Angular project:
ng build --prod
After you can do the:
firebase serve
Hope it will be helpful for beginners.
Ok so got this working but pretty much had to start from scratch again. I deleted the public folder and just moved my html, css, js, and node-module folders out of my project directory and then re-installed firebase-tools and ran the 'firebase init' command and then restarted the localhost server and everything started working again. After which point I moved back all my previous folders and things are working as before.
Not a 100% sure how the issue happened but at one point I did delete my index.html file and then put it back in later on as I was testing something. At which point I feel the issue started. I will try to test this scenario in a test project but I guess for the time being don't delete your index.html file just modify the existing one. Thanks all.
The error message shows up if you run 'firebase serve' within the project folder.
Navigate to the parent folder (up one level) using 'cd ..' and start the server from there.
Please check if content of your website is present in folder
"hosting": {
"public": "<folder with your website files>",
from your config "firebase.json"
If you like me, before overthinking the problem, make sure you provided the correct URL to index.html.
In my case, I didn't take into account different structure of my directory. You should provide the path to index.html relative to the root directory of your firebase project. For example, in my case, the correct URL was http://localhost:5000/button-component/public/

Resources