How to use Babylon with Next JS

I see you are on Windows, perhaps @labris can help. But the error message in the console says you that you haven’t installed dependencies. You should run:

yarn

first per instructions to install dependencies → only if that is successful, can you continue. I’m not on windows, unfortunately, so I cannot help debugging. In general, avoid using npm, use yarn, because it manages dependencies better.

When i have a chance to install virtual Windows OS, will look into this. And yes, Next.js is not newbie friendly a.t.m. because it is mainly for experienced devs (you can tell by the kind of docs they write on the official site).

Actually, most frontend tools these days assume you are experienced :joy:

1 Like

HI ecoin—it worked. I just forgot to type yarn. Thanks for all your help and persistence with this. I really appreciate it

ecoin i have found that you git repo works perfectly on windows. It is great and easy to use. One thing i have also found is that it only works if you use npm i yarn (it doesnt work if using npm install --global yarn).

1 Like

Hi ecoin do you think it would be possible to use your git clone below (which looks like it turns off SSR) and link it with a standard SSR Next JS app. The outcome i am trying to achieve is to have an app which has a SSR next website and able to click on a button or route to then run a BabylonJS app as one page in the overall app. I tried to do this by using node child_process in Next JS but that seems quite difficult to make it work also. Thanks again for your help John

git clone GitHub - ecoinomist/babylon-next: Babylon + Next.js Production Setup - Minimum Starter Template your-project-name

Hi John, not sure I understand your question. What do you mean by “looks like it turns off SSR”? Do you want to server side render Babylon? (the setup disables compiling/initializing Babylon on the server side to reduce unnecessary CPU resource consumption, because there is no WebGL on the server side to render anything anyway, which may even through error if you try to).

If you think that you need Babylon on the server side, it might be time to rethink your architecture. The only reason I’d do that is for the headless Babylon version.