flowershow icon indicating copy to clipboard operation
flowershow copied to clipboard

Cannot preview nor build my garden

Open hvitis opened this issue 1 year ago • 14 comments

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/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @silvenon/[email protected]: renamed to just "remark-smartypants"
npm WARN deprecated @floating-ui/[email protected]: Package renamed to @floating-ui/react
npm WARN deprecated [email protected]: < 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/[email protected] predev
> npm run generate


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

❯ npx flowershow@latest preview

> @flowershow/[email protected] predev
> npm run generate


> @flowershow/[email protected] 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):

  • OS MacOS

hvitis avatar May 21 '23 21:05 hvitis

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 avatar May 21 '23 21:05 hvitis

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

borisalmonacid avatar May 22 '23 22:05 borisalmonacid

@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 avatar May 23 '23 07:05 rufuspollock

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

rufuspollock avatar May 23 '23 07:05 rufuspollock

@rufuspollock It exits without any error or feedback

hvitis avatar May 23 '23 07:05 hvitis

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?

olayway avatar May 23 '23 10:05 olayway

@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

hvitis avatar May 23 '23 10:05 hvitis

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

olayway avatar May 23 '23 12:05 olayway

@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

borisalmonacid avatar May 23 '23 15:05 borisalmonacid

@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?

olayway avatar May 23 '23 17:05 olayway

@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.

borisalmonacid avatar May 23 '23 19:05 borisalmonacid

@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!

olayway avatar May 24 '23 08:05 olayway

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

> [email protected] export
> npm run build && next export


> [email protected] prebuild
> npm run generate


> [email protected] 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

> [email protected] predev
> npm run generate


> [email protected] 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.

TBiele avatar Jun 16 '23 20:06 TBiele

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.

ixnet avatar Jul 27 '23 19:07 ixnet