QTREE
QTREE

Reputation: 3

npm start is not working (WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE)

I tried creating a new react app by

npx create-react-app myapp    
cd myapp
npm start

I'm using react version 18.2.0

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },

Then I got an err and my app is also not opening in the browser. (I tried manually opening the localhost but no luck)

(node:8168) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:8168) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

Upvotes: 0

Views: 1308

Answers (1)

yanir midler
yanir midler

Reputation: 2702

Tried changing the names in webpackDevServer.config.js it worked for me.

1. Open node_modules folder.
2. Search for webpackDevServer.config.js.
3. Open the js file and edit it.

Upvotes: 1

Related Questions