Coder Social home page Coder Social logo

Comments (8)

LevYas avatar LevYas commented on August 17, 2024 1

I tried to run it with google, ChatGpt but with no luck. Apparently, PM2 does not work on windows, although some issues are marked as "closed". I tried some workarounds, and for me, this one worked:

  1. Create 'ecosystem.config.json`:
{
  "apps" : [
     {
        "name"          : "Start page",
        "script"        : "node_modules/next/dist/bin/next",
        "args"          : "start",
        "cwd"           : "D:/_My/excalith-start-page"
     }
  ]
}
  1. Start using pm2 start ecosystem.config.json

BUT, according to the docs, pm2 startup is not supported on Windows (see at the bottom of the page).

How do you think, is it possible to create a server script and register a service, like in Chevron? That project uses NPM instead of Yarn and some other dependencies, but maybe it's possible to adapt.

from excalith-start-page.

excalith avatar excalith commented on August 17, 2024 1

Yesterday I managed to run it as a service just like you mentioned. I think it supports Windows startup, but not without any other modifications. Chevron uses a different package, haven't used it for such purposes before but will give it a try soon. Thanks for the support mate!

from excalith-start-page.

LevYas avatar LevYas commented on August 17, 2024

Gave it a try today, I executed the same command node .next/standalone/server.js and it worked. Magic!

from excalith-start-page.

LevYas avatar LevYas commented on August 17, 2024

Hm, no, after building via yarn build it does not work anymore. Restarting terminal/browser/VS Code/computer does not help. Looks like some files are not copied to a location where they should be. Anyway, some assistance would be great.

from excalith-start-page.

excalith avatar excalith commented on August 17, 2024

Sorry mate, seems like I missed the notification for your report there. Will have a look at that soon. Cheers!

Related to #32

from excalith-start-page.

excalith avatar excalith commented on August 17, 2024

Just realised I forgot to update redundant yarn export command on documentation. Since the project got more features, I had to use API calls and exporting a static page won't work. However, it is still possible to build and serve locally, just like development mode.

Wanted to quickly check out whats going on and turns out it works as intended on my end. Here is my logs with clean state:

yarn build
Skipped eslint warnings

 ✓ Linting and checking validity of types
   ▲ Next.js 14.0.4
   - Environments: .env

 ✓ Creating an optimized production build
 ✓ Compiled successfully
 ✓ Collecting page data
 ✓ Generating static pages (3/3)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (pages)                              Size     First Load JS
┌ ○ /                                      45.1 kB         127 kB
├   └ css/607fb85db1ac148f.css             645 B
├   /_app                                  0 B            82.1 kB
├ ○ /404                                   181 B          82.3 kB
├ λ /api/getData                           0 B            82.1 kB
├ λ /api/getTheme                          0 B            82.1 kB
├ λ /api/loadSettings                      0 B            82.1 kB
└ λ /api/saveSettings                      0 B            82.1 kB
+ First Load JS shared by all              85.4 kB
  ├ chunks/framework-5429a50ba5373c56.js   45.2 kB
  ├ chunks/main-359cf9259ad67a06.js        31.7 kB
  ├ chunks/pages/_app-f1f6d5684b7c625b.js  3.46 kB
  ├ chunks/webpack-4461f78ae6345ca1.js     1.77 kB
  └ css/dec7afba07758c41.css               3.35 kB

○  (Static)   prerendered as static content
λ  (Dynamic)  server-rendered on demand using Node.js

Done in 16.33s.

yarn start

yarn run v1.22.21
$ next start
   ▲ Next.js 14.0.4
   - Local:        http://localhost:3000

 ⚠ "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.
 ✓ Ready in 500ms

On my end, ⚠ "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead. is a warning and seems like an issue on nextjs side since it generates the build files and reads from there itself.

After launching my localhost:3000 no errors / warnings thrown on my console. Just in case, can you try out 127.0.0.1:3000 as well?

Regarding to an easy self-hosting you mentioned, I suggest using something like PM2 or something similar to that to have control over background processes instead. I used PM2 for a few personal projects long before and it really is intuitive, like managing docker containers. After fixing this issue, I will try out this project with PM2 and update documentation with required steps to install and run.

from excalith-start-page.

LevYas avatar LevYas commented on August 17, 2024

Teşekkür ederim for looking into this!
Ha, I didn't notice that ⚠ "next start" does not work with "output: standalone" configuration. is actually a warning, it sounded like an error 😄.
Yes, with yarn start it works well.

On PM2 - I installed it successfully, but what arguments should I use?
pm2 start yarn -- start gives me [PM2][ERROR] Script not found: D:\_My\excalith-start-page\start
pm2 start yarn --interpreter bash --name "Start page" -- start gives the same error
pm2 start .\.next\standalone\server.js results in the error I mentioned in the first post (all 404).

I googled the error but looks like I need to create a deploy.json file and specify absolute paths. I'm not sure what paths should I use for yarn, and I'm feeling like I'm going too deep and there should be a simpler solution. Any advice?

from excalith-start-page.

excalith avatar excalith commented on August 17, 2024

For PM2 I need to do some research, its been ages since I last used it :D Will check it when I find time, but if you find a way before me please let me know

from excalith-start-page.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.