Ask coding questions

← Back to all posts
TypeScript in a Node.js project
PabloSzx (4)

Hi, I just installed TypeScript in a Next.js project and when I try to import from react it just says, "Cannot find module 'react'."

HackermonDev (2020)

You don't need to import react in a next project

PabloSzx (4)

@PDanielY The fact that I'm not using any of the library doesn't mean that it will work, I will add a useState that changes an input to show that the error persists

PabloSzx (4)

@PDanielY I just added a simple useState + input, that does need to import React, and even the JSX is showing the error "Cannot Find React"

pkme (0)

I have this same issue, any guidance?


what is the goal of this repl?

PabloSzx (4)

@Zuhdi28 to show TypeScript + Next.js?

PabloSzx (4)

The code actually runs ok, and it type-checks, but the editor itself shows it like an error

maxbethke (0)

@PabloSzx I have the same stange thing in my I feel like the project type should be typescript instead of node.js