Hello I tried to install the express package in a react project But when I import the package inside the app.js using:
const app = require("express");
I get 30 errors all saying
Module not found Error: Can't resolve 'x'
where x are differnt packages like zlib, querystring, path, crypto, fs, stream ....
This is the app.js code when I run it without the require line it works fine
import logo from './logo.svg';
import './App.css';
const app = require("express");
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
And inside my package.json file in my dependencies I do have: "express": "^4.17.3"
I even tried to create a new blank project for this and I had the same problem