[React] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema
|2023. 4. 17. 19:55
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
'개발&etc > React' 카테고리의 다른 글
[React] express개발 code:'MODULE_NOT_FOUND' 에러 (0) | 2023.04.17 |
---|---|
[React] Node JS 버전 변경 - windows (0) | 2023.04.17 |
[React] 오류: react-router-dom 설치 후 Route 오류 (0) | 2023.03.24 |
[React] 에러: Cannot find module 'react' (0) | 2023.03.24 |
[React] node 버전 다운 그레이드 하기 (0) | 2023.03.24 |