-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated #12035
Comments
I'm having the same warning too |
me too
|
same issue |
i have the same problem |
I thought i was the only one. but let me ask something is this error has to do with the ERR_CONNECTION_REFUSED error? |
Same Error here. |
Same error in docker container. Docker version is 20.10.12, base image is node:alpine |
I am getting the same error: "(node:9112) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. |
The same thing here after upgrade to ..... "react-scripts": "^5.0.0" (Node 16.*) $ npm start
(node:21944) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. (node:21944) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. Compiled successfully! webpack 5.70.0 compiled successfully in 18347 ms |
Is this a duplicate of #11860 ? |
This warning disappeared using the repair option in the node.js file. It worked for me
|
i am facing node(8868) type of error. Please help me solve the problem |
I got also the same warning! |
I am facing the same issue |
Would you all stop spamming? What is the purpose of you writing that you have the same issue? Will that fix the issue quicker? Subscribe to the issue and shut up |
I have de same error with node 17-slim image in docker but in my computer I have node 17.7.0 and doesn't has the warning |
Known issues: 1. `npm start` variable `BROWSER` is not working: facebook/create-react-app#11873 2. `[DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Ple ase use the 'setupMiddlewares' option.`: facebook/create-react-app#12035
Known issues: 1. `npm start` variable `BROWSER` is not working: facebook/create-react-app#11873 2. `[DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Ple ase use the 'setupMiddlewares' option.`: facebook/create-react-app#12035
(node:39133) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. any solution for this warning? |
I have the same issue |
What did you do? |
Deleting node_modules and run npm install has fixed for me. Probably some dependency has to be update |
which dependency needs to update
…On Mon, Apr 11, 2022 at 11:43 AM FrancescoVarsallona < ***@***.***> wrote:
Deleting node_modules and run npm install fixed for me. Probably some
dependency has to be update
—
Reply to this email directly, view it on GitHub
<#12035 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATBEWHBBQCV5H4E4L2UJXRLVEO7KJANCNFSM5N4363XA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I am getting same warnings in multiple systems which have been installed at different point of time. I have tried removing and installing fresh did not fix the issue. My environment is Node 16.13.1, NPM 8.3.0 |
My way of solving this was... npm run build, then npm install -g serve, |
Thank Richard! It's working well |
I have got also the same problem. What is the best solution for this? |
npx server does not dynamically update on mine. is yours updating the changes in the project automatically? |
I updated my npm version from linux. You can type sudo npm update -g npm. |
"overrides": { |
Though this is not working for me yet I want to know how you come up with this solution. |
I think this guys solution is correct https://www.youtube.com/watch?v=ifSTp9WEHpo After I saw this youtube, problem is solved |
run the command in the shell "npm update" it will work |
use "npm update " command in the shell |
npm update worked for me |
npm update or yarn upgrade not worked for me |
its funny, your tips not work when i have develop server automated create for all develops hidding node_modules, this is not a result |
I have the same issue |
this solved it for me but its modifying on the node modules :/ |
but it don't work when you host the server cuz you cant change it there as this must be done in node modules |
How we will edit the code insode node-modules on deployment pipeline |
Follow this: DeprecationWarning Solution: (node:2772) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: Error code like this: (select and remove it) onBeforeSetupMiddleware(devServer) {
},
}, Change to this: (past it on there) setupMiddlewares: (middlewares, devServer) => {
}, https://github.com/tamim-jr/onAfterSetupMiddleware-option-is-deprecated./blob/main/src/Solution.txt |
I did |
It seems like Create React App is dead and this issue will never be fixed. The best solution is to use Vite instead. |
removing the following code from onBeforeSetupMiddleware(devServer) {
// Keep `evalSourceMapMiddleware`
// middlewares before `redirectServedPath` otherwise will not have any effect
// This lets us fetch source contents from webpack for the error overlay
devServer.app.use(evalSourceMapMiddleware(devServer));
if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons
require(paths.proxySetup)(devServer.app);
}
},
onAfterSetupMiddleware(devServer) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
}, |
Hi All, Please refer to this article for an alternative snippet to "onBeforeSetupMiddleware" and "onAfterSetupMiddleware" within https://discuss.codecademy.com/t/react-app-error/779264/2 This has fixed the error for me! 👍 |
I used have same issue i rectified it by below solution Step-1 Go to this file path : node_modules\react-scripts\config\webpackDevServer.config.js onBeforeSetupMiddleware(devServer) { Step - 3 With the below code setupMiddlewares: (middlewares, devServer) => { |
This was the error I had (node:20104) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupM
Compiled successfully! After a number of searches and trials, I solved it by visiting
And replaced this deprecated code: onAfterSetupMiddleware(devServer) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
}, With this current one: setupMiddlewares: function(middlewares, devServer) {
// Middleware setup code
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
return middlewares;
}, |
I used Cargo(https://craco.js.org/docs/configuration/devserver/) to overwrite Weppack configs. cargo.config.js
|
It worked for me, thanks |
facing same issue : any solutions to this? |
great thanks! |
just install webvital by |
npm install web-vitals |
I got a warning when npm start.
Please help me solve the problem.
(node:1681) [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:1681) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
The text was updated successfully, but these errors were encountered: