wufe / react-particles-js

Particles.js for React
https://rpj.bembi.dev/
MIT License
1.16k stars 106 forks source link

[Bug] TypeError: Cannot read property 'circle' of undefined in Next.JS #167

Closed JaeWangL closed 3 years ago

JaeWangL commented 3 years ago

I'm working this library with next.js

    "next": "10.0.5",
    "react": "^17.0.1",
    "react-particles-js": "^3.4.1",
      <Particles
        params={{
          particles: {
            number: {
              value: 160,
              density: {
                enable: false,
              },
            },
            size: {
              value: 3,
              random: true,
              anim: {
                speed: 4,
                size_min: 0.3,
              },
            },
            line_linked: {
              enable: false,
            },
            move: {
              random: true,
              speed: 1,
              direction: 'top',
              out_mode: 'out',
            },
          },
          interactivity: {
            events: {
              onhover: {
                enable: true,
                mode: 'bubble',
              },
              onclick: {
                enable: true,
                mode: 'repulse',
              },
            },
            modes: {
              bubble: {
                distance: 250,
                duration: 2,
                size: 0,
                opacity: 0,
              },
              repulse: {
                distance: 400,
                duration: 4,
              },
            },
          },
        }}
      />

But when I run my app package says "TypeError: Cannot read property 'circle' of undefined"

ThanadetManichote commented 3 years ago

I am too .

"next": "10.0.3", "react": "17.0.1", "react-particles-js": "3.4.1",

Screen Shot 2564-03-09 at 17 55 32
traubas commented 3 years ago

me too. it worked until today. been working with it for the last 1 year.

matteobruni commented 3 years ago

Hi @JaeWangL and @traubas,

You can fix that installing tsparticles@1.19.2. I made a change in 1.19.3 that broke this package. I’ll fix it ASAP.

Sorry for the inconvenience

JaeWangL commented 3 years ago

Hi @JaeWangL and @traubas,

You can fix that installing tsparticles@1.19.2. I made a change in 1.19.3 that broke this package. I’ll fix it ASAP.

Sorry for the inconvenience

This work!! Thank you~~

Ayoubho22 commented 3 years ago

is it like npm install tsparticles@1.19.2 ?? I'm new to React, anyway when I run the command nothing change it's still giving me the error 'TypeError: Cannot read property 'circle' of undefined' thanks in advance

GitGitBoom commented 3 years ago

@Ayoubho22 you need to replace the sub-dependency. In yarn you can use resolutions. Npm is a bit more of a pain.

Yarn: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

NPM: https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions

Thanks @matteobruni for the quick support.

matteobruni commented 3 years ago

I released 1.19.4 with the bug fix. Everything should be fine now.

RilleMichi commented 3 years ago

Hi @GitGitBoom

Can you maybe write it down (with yarn)? I tried, but it didn't work. Thanks in advanced. Im also just a beginner :)

matteobruni commented 3 years ago

@RilleMichi just update the tsparticles dependency and you're done

wufe commented 3 years ago

@lindelof tsparticles is not an advertised library, but a dependency of react-particles-js. @matteobruni is the creator of tsparticles, so listen to him

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.