React(CRA)에서 jsconfig.json 사용시 SyntaxError 해결방법

SeHun.J·2024년 5월 9일

에러발생

crate-react-app으로 만든 프로젝트에서 경로를 깔끔하게 관리하기 위해 jsconfig.json을 통해 절대경로를 설정하였습니다.

하지만 npm start로 react를 실행해본 결과 아래와 같은 메시지가 떴습니다.

node:internal/modules/cjs/loader:1456
    throw err;
    ^

SyntaxError: C:\frontend\jsconfig.json: Expected property name or '}' in JSON at position 37
    at parse (<anonymous>)
    at Module._extensions..json (node:internal/modules/cjs/loader:1453:39)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at getModules (C:\frontend\node_modules\react-scripts\config\modules.js:126:14)
    at Object.<anonymous> (C:\frontend\node_modules\react-scripts\config\modules.js:142:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

해결방법

구글링으로 찾아본 결과 jsconfig.json 파일에 주석이 있으면 안된다고 합니다.
그래서 주석을 지운 결과,
성공

profile
취직 준비중인 개발자

0개의 댓글