728x90

 

🥐 오류

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema

 

🥐 해결 방법

1. npm install http-proxy-middleware --save 설치

2. src 폴더 밑에 setupProxy.js 파일 만들기

const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'http://localhost:8080',
      changeOrigin: true,
    })
  );
};

 

 

이래도 안된다...? 에서 

그러면 package.json react-scripts 버전을 바꿔준다...

# 변경 전
"react-scripts": "5.*", 

# 변경 후
"react-scripts": "4.0.3",

 

그리고 node_modules 삭제 하고 다시 설치한다. 그리고 실행!!!!!!!!!!

 

참고: 

 

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema

I have been stuck on this error in my project when I add "proxy": "http://localhost:6000" in my package.json. This is the error response after yarn start. Invalid options objec...

stackoverflow.com

 

728x90