📌 React
[React] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined 에러
Awesome Soo
2022. 10. 14. 09:25
문제
오래전에 작업하던 프로젝트에 yarn 설치를 하고 yarn start 를 하니 아래와 같이 에러 메시지가 떴다.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.join (node:path:429:7)
원인
react-scripts의 버전이 맞지 않아 발생하는 문제였다.
프로젝트의 package.json 파일을 열어 "dependencies" 의 안 "react-scripts" 를 확인해준다.
"react-scripts": "3.3.0" 이라고 되어 있다.
해결
이를 "react-scripts": "3.4.0" 로 변경해준다.
그리고 node_modules 폴더와 package-lock.json 파일을 삭제 후,
yarn 명령어를 사용하여 패키지를 재설치하여 해결했다.
반응형