datopian / flowershow

💐 Publish your obsidian digital garden or any markdown site easily and elegantly.
https://flowershow.app/
MIT License
756 stars 92 forks source link

Cannot preview nor build my garden #505

Open hvitis opened 1 year ago

hvitis commented 1 year ago

Describe the bug Preview and Build commands do not work.

To Reproduce I have installed the flowershow sucessfully:

Log:

npx flowershow@latest install
? Create Flowershow project in current directory? Yes
? Flowershow template is already installed in directory MYDIR.
 What do you want to do?: Overwrite
? Path to the folder with your markdown files book/aphorisms
? There are no subfolders in your content folder, that could be used as assets folder I don't need assets folder
 INFO  No index.md file found in MYDIR. Flowershow will create one for you.
 INFO  No config.mjs file found in MYDIR. Flowershow will create one for you.
⠋  Creating Flowershow template in MYDIR
🌷  Creating Flowershow template in MYDIR/.flowershow
Created symlinks:
MYDIR
⠸  Installing Flowershow dependencies
⠴  Installing Flowershow dependencies
⠧  Installing Flowershow dependencies
⠇  Installing Flowershow dependencies
⠙  Installing Flowershow dependencies
added 599 packages, and audited 600 packages in 42s

189 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @silvenon/remark-smartypants@2.0.0: renamed to just "remark-smartypants"
npm WARN deprecated @floating-ui/react-dom-interactions@0.13.3: Package renamed to @floating-ui/react
npm WARN deprecated puppeteer@18.2.1: < 19.4.0 is no longer supported
🌸  Installing Flowershow dependencies
🎊 Successfully installed Flowershow!

Then I run preview and build commands:

LOGS:

❯ npx flowershow@latest preview

> @flowershow/template@2.0.3 predev
> npm run generate

> @flowershow/template@2.0.3 generate
> cross-env NODE_OPTIONS="--experimental-json-modules --experimental-modules" node -r esbuild-register ./scripts/postbuild.mjs

❯ npx flowershow@latest preview

> @flowershow/template@2.0.3 predev
> npm run generate

> @flowershow/template@2.0.3 generate
> cross-env NODE_OPTIONS="--experimental-json-modules --experimental-modules" node -r esbuild-register ./scripts/postbuild.mjs

Expected behavior I should be able to see on localhost 3000 my preview.

Desktop (please complete the following information):

hvitis commented 1 year ago

Not sure how to test your solution. After entering .flowershow and trying to run npm myself I am getting a lot of errors and missing packages. Please let users know that the app is in development mode, not ready to be tested yet.

borisalmonacid commented 1 year ago

in my first run, I can see the webpage in localhost:3000, but in the other run, the system puts another URL, for example, localhost:3001, localhost:3002, in those URLs I can't see the webpage.

image

rufuspollock commented 1 year ago

@borisalmonacid that change in port will happen if you still have the first instance running. If you cancel the first preview e.g. do ctrl+c then run a new preview it will be on port 3000.

rufuspollock commented 1 year ago

@hvitis what happens on the terminal after that last step?

hvitis commented 1 year ago

@rufuspollock It exits without any error or feedback

olayway commented 1 year ago

Not sure how to test your solution. After entering .flowershow and trying to run npm myself I am getting a lot of errors and missing packages. Please let users know that the app is in development mode, not ready to be tested yet.

@hvitis Thanks for reporting this! Can you post these error logs here? Also, which version of Node do you use?

hvitis commented 1 year ago

@olayway sure. I posted those logs above. That's all I'm getting. I was surprised too cause couldn't debug myself. Node v 16.15.1

olayway commented 1 year ago

@hvitis I mean the error logs you're getting when trying to run npm run dev from within the .flowershow.

borisalmonacid commented 1 year ago

@borisalmonacid that change in port will happen if you still have the first instance running. If you cancel the first preview e.g. do ctrl+c then run a new preview it will be on port 3000.

I have done the steps, but even with ctrl+c another new preview is created. image

Environment: Edition Windows 10 Pro Version 22H2 Installed on ‎31-‎03-‎2022 OS build 19045.2965 Experience Windows Feature Experience Pack 1000.19041.1000.0


But with the command taskkill /f /im node.exe the problem is solved.

image

olayway commented 1 year ago

@borisalmonacid Thank you so much for reporting this! 🌻

The issue you're experiencing might be due to how Windows handles process termination. When you hit Ctrl+C, it sends a signal to the process to terminate itself, but this doesn't always ensure all child processes are also terminated. When you're running npx flowershow preview, it's spawning additional processes (such as the Next.js server itself) which aren't being properly shut down when the parent npm process is terminated.

Anyway, I've just published a patch that should fix this. Can you please give it a go and run npx flowershow@latest preview and let me know if it worked?

borisalmonacid commented 1 year ago

@borisalmonacid Thank you so much for reporting this! 🌻

The issue you're experiencing might be due to how Windows handles process termination. When you hit Ctrl+C, it sends a signal to the process to terminate itself, but this doesn't always ensure all child processes are also terminated. When you're running npx flowershow preview, it's spawning additional processes (such as the Next.js server itself) which aren't being properly shut down when the parent npm process is terminated.

Anyway, I've just published a patch that should fix this. Can you please give it a go and run npx flowershow@latest preview and let me know if it worked?

image

The website works generating the new deploy on the new port 0001, but the old one is still open (port 0000).

I have seen that it generates two things in the first port 0000: (1) it tries to update with very fast updates but it does not update. (2) works, I guess it's a cache.

I'm sorry I can't send more technical information, I've only been studying web development for a few days.

olayway commented 1 year ago

@borisalmonacid from your logs it seems you run npx flowershow@latest install before you killed the process running on port 3000 - which was spawned by the previous CLI version and so was not propely terminated - thus the patch I've added yesterday. Can you first kill it with taskkill and then run the preview command again? And then try killing it with Ctrl+C and running preview again to see if the port is now 3000?

I'm sorry I can't send more technical information, I've only been studying web development for a few days.

No worries, been there and done that ;) Have lots of fun on your coding journey!

TBiele commented 1 year ago

I have the same problem as @hvitis. I followed the steps in https://flowershow.app/docs/publish-tutorial both with my own files as well as initializing a directory from scratch. npx flowershow@latest preview and npx flowershow@latest export terminate without any result. The output for preview is the same as for @hvitis. This is the output for export:

> npx flowershow@latest export

> flowershow@2.0.3 export
> npm run build && next export

> flowershow@2.0.3 prebuild
> npm run generate

> flowershow@2.0.3 generate
> cross-env NODE_OPTIONS="--experimental-json-modules --experimental-modules" node -r esbuild-register ./scripts/postbuild.mjs

Afterwards nothing is running at http://localhost:3000/ and no directory .flowershow/.next is generated.

When I execute npm run dev inside .flowershow I get this:

> npm run dev

> flowershow@2.0.3 predev
> npm run generate

> flowershow@2.0.3 generate
> cross-env NODE_OPTIONS="--experimental-json-modules --experimental-modules" node -r esbuild-register ./scripts/postbuild.mjs

node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module 'esbuild'
Require stack:
- /home/helix/Downloads/some-parents-dir/.flowershow/node_modules/esbuild-register/dist/node.js
- /home/helix/Downloads/some-parents-dir/.flowershow/node_modules/esbuild-register/register.js
- internal/preload
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/helix/Downloads/some-parents-dir/.flowershow/node_modules/esbuild-register/dist/node.js:4622:16)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/helix/Downloads/some-parents-dir/.flowershow/node_modules/esbuild-register/dist/node.js',
    '/home/helix/Downloads/some-parents-dir/.flowershow/node_modules/esbuild-register/register.js',
    'internal/preload'
  ]
}

I ran npm install as well.

ixnet commented 11 months ago

Hi everyone! Faced with that issue as well, I tried to run flowershow on Windows.


I got the same issue on my Kali Linux, seems like OS is not a root cause.