Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Strange hooks error

default discord avatar
kobeaerts2 years ago
8

I'm starting with payload and everything works but now suddenly I'm getting this weird React Hooks error. 😦



I've attached my config files over here:

https://gist.github.com/kobeaerts/cd40e51224f9821b3ea06c3858f39a65

Any ideas?

  • discord user avatar
    alessiogr
    2 years ago

    What build tool are you using? If it's yarn, can you run

    yarn why react

    ?

  • default discord avatar
    kobeaerts2 years ago
    C▲ Sites/dcide-payload  yarn why react
    yarn why v1.22.15
    [1/4] 🤔  Why do we have the module "react"...?
    [2/4] 🚚  Initialising dependency graph...
    [3/4] 🔍  Finding dependency...
    [4/4] 🚡  Calculating file sizes...
    => Found "react@18.2.0"
    info Reasons this module exists
       - "payload" depends on it
       - Hoisted from "payload#react"
    info Disk size without dependencies: "320KB"
    info Disk size with unique dependencies: "352KB"
    info Disk size with transitive dependencies: "380KB"
    info Number of shared dependencies: 2
    ✨  Done in 0.67s.
    ▲ Sites/dcide-payload  

    `



    Ok, I deleted all my lock files and ran a new fresh install, that fixed it 😐

  • default discord avatar
    pooledge2 years ago

    It didn't for me, using

    npm
  • default discord avatar
    kobeaerts2 years ago

    Well fuck me, it's back 😄

  • default discord avatar
    cbregante2 years ago

    i have same error after install @aws-sdk/client-s3 and @aws-sdk/lib-storage


    but i cannot solve 😒

  • default discord avatar
    pooledge2 years ago

    i ve summoned a new payload app in a different dir and it seems to work now



    so i guess it's not about react after all (sorry)



    as soon as I do

    npm i

    or

    npm update

    bahbye



    so as soon as any installation process apart from the scaffolding

    create-payload-app

    is involved it stops working



    ok I was able to mitigate this issue after installing latest

    react

    and

    react-dom

    as dev dependencies

  • default discord avatar
    edubasabe2 years ago

    Adding this to my package.json has fixed this error.


      "overrides": {
        "react": "18.2.0"
      }
  • discord user avatar
    dribbens
    2 years ago

    We have some changes in a canary release that should address the react dependencies problems.


    You can wait for the release (probably tomorrow) or if you want to try the canary, pin your version in package.json to dependency

    "payload": "1.8.3-canary.1" The changes make it so you don't need

    overrides

    or

    resolutions

    or

    --legacy-peer-deps`

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.