I can\'t believe that I\'m asking an obvious question, but I still get the error in console log.
Console says that it can\'t find the module in the directory, but I\
In my case I rename a component file, an VS Code add the below line of code for me:
import React, { Component } from "./node_modules/react";
So I fixed by removing the: ./node_modules/
import React, { Component } from "react";
Cheers!
You need to be in project folder, if you are in src
or public
you have to come out of those folders. Suppose your react-project name is 'hello-react' then cd hello-react
Check for the import statements.It should be ended with semicolon. If you miss any, you will get this error.
Also check whether following import statement added in you component.
import { threadId } from 'worker_threads';
If so remove that line. It works for me.
You can try to execute 'npm install' in the app folder. This might also solve the problem. It worked for me.
Deleted the package-lock.json file & then ran
npm install
Read further
If you create an application with react-create-app, don't forget set environment variable:
NODE_PATH=./src
Or add to .env
file to your root folder;