'How to install next-js with react 17?

How I can install next.js with React 17? When I type: npx create-next-app --ts, npx installed Next with React 18, but I can't use React 18, because Stripe not working at the moment with R18 (https://www.npmjs.com/package/stripe).



Solution 1:[1]

You'd need to use an older version of Next JS.

The latest one I can see with React 17 is 12.1.2, so you can start your project with the following:

npx [email protected]

You can check the release change logs for Next JS here: https://github.com/vercel/next.js/releases

Solution 2:[2]

If you've already created the project:

remove new versions:

npm uninstall next react react-dom @types/react @types/react-dom 

install old versions:

npm install [email protected] [email protected] [email protected]
npm install -D @types/[email protected] @types/[email protected]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JBS
Solution 2 GorvGoyl