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
kobeaerts3 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
    3 years ago

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

    yarn why react

    ?

  • default discord avatar
    kobeaerts3 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
    pooledge3 years ago

    It didn't for me, using

    npm
  • default discord avatar
    kobeaerts3 years ago

    Well fuck me, it's back ๐Ÿ˜„

  • default discord avatar
    cbregante3 years ago

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


    but i cannot solve ๐Ÿ˜’

  • default discord avatar
    pooledge3 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
    edubasabe3 years ago

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


      "overrides": {
        "react": "18.2.0"
      }
  • discord user avatar
    dribbens
    3 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.