Skip to content

npx polar-migrate fails with “Invalid hook call” error #8

@RaminGe

Description

@RaminGe

Hi there!

When I try to run the migration using npx polar-migrate, the command fails after selecting my store and environment. The interactive prompts work, but then I get an "Invalid hook call" error related to React. I tried it with both the sandbox and production environment.

Command output

 npx polar-migrate
✔ Enter your LemonSqueezy API Key … *********
✔ Select a store › XXX
✔ Which Polar environment would you like to run the migration in? › Production
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.

  ERROR  Cannot read properties of null (reading 'useState')

 /Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/react/cjs/react.development.js:1222:33

 1219:       return resolveDispatcher().useRef(initialValue);
 1220:     };
 1221:     exports.useState = function (initialState) {
 1222:       return resolveDispatcher().useState(initialState);
 1223:     };
 1224:     exports.useSyncExternalStore = function (
 1225:       subscribe,

 - process.env.NODE_ENV.exports.useState (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/react/cjs/react.development.js:1222:33)
 - useSpinner (file:///Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/@inkjs/ui/build/components/spinner/use-spinner.js:4:31)
 - Spinner (file:///Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/@inkjs/ui/build/components/spinner/spinner.js:6:23)
 -renderWithHook (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.dev
                elopment.js:6659:18)
 -mountIndeterminateComp (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconc
  nent                  iler.development.js:11276:13)
 -beginWork (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.developm
           ent.js:12799:16)
 -beginWork$ (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.develop
            ment.js:19608:14)
 -performUnitOfWo (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.de
  k              velopment.js:18742:12)
 -workLoopSyn (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.develo
             pment.js:18648:5)
 -renderRootSyn (/Users/XXX/.npm/_npx/f3d66b46da123492/node_modules/polar-migrate/node_modules/react-reconciler/cjs/react-reconciler.deve
               lopment.js:18616:7)

Steps to reproduce

  1. Run npx polar-migrate in a fresh project
  2. Enter API key, select store and environment
  3. See error

Expected behavior

The migration should run successfully without React hook errors.

Environment

  • OS: macOS 15.6.1 (24G90)
  • Node.js: v22.12.0
  • npm: 10.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions