8.React/3)트러블슈팅_React

트러블슈팅_React_02

구이제이 2024. 5. 4. 17:34

 

20240504

 

●원인

Compiled with problems:

×

ERROR in ./src/App.js 32:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src'

ERROR in ./src/component/list/CommentList.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\list'

ERROR in ./src/component/list/CommentListItem.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\list'

ERROR in ./src/component/list/PostList.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\list'

ERROR in ./src/component/list/PostListItem.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\list'

ERROR in ./src/component/page/MainPage.jsx 7:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\page'

ERROR in ./src/component/page/PostViewPage.jsx 7:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\page'

ERROR in ./src/component/page/PostViewPage.jsx 105:37-48

export 'default' (imported as 'CommentList') was not found in '../list/CommentList' (module has no exports)

ERROR in ./src/component/page/PostWritePage.jsx 7:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\page'

ERROR in ./src/component/ui/Button.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\ui'

ERROR in ./src/component/ui/TextInput.jsx 5:0-39

Module not found: Error: Can't resolve 'styled-components' in 'C:\Users\user\Desktop\react\test20240504\shop\src\component\ui'



●해결

 

본체를 설치 안하고 본체 명세서만 설치하셔서 그렇습니다. 다음의 명령어로 추가 설치 해주세요.

npm install --save styled-components

[출처사이트 : https://okky.kr/questions/1214254]




20240504

 

●원인

 

Compiled with problems:

×

ERROR in ./src/component/page/PostViewPage.jsx 105:37-48

export 'default' (imported as 'CommentList') was not found in '../list/CommentList' (module has no exports)



●해결

PostViewPage.jsx에 export defalult CommentList;가 빠져있어서 추가해줫습니다.



20240504

 

●원인

 

Uncaught runtime errors:

×

ERROR

post is not defined

ReferenceError: post is not defined

    at http://localhost:3003/static/js/bundle.js:400:15

    at Array.map (<anonymous>)

    at PostList (http://localhost:3003/static/js/bundle.js:398:21)

    at renderWithHooks (http://localhost:3003/static/js/bundle.js:25007:22)

    at mountIndeterminateComponent (http://localhost:3003/static/js/bundle.js:28978:17)

    at beginWork (http://localhost:3003/static/js/bundle.js:30281:20)

    at HTMLUnknownElement.callCallback (http://localhost:3003/static/js/bundle.js:15263:18)

    at Object.invokeGuardedCallbackDev (http://localhost:3003/static/js/bundle.js:15307:20)

    at invokeGuardedCallback (http://localhost:3003/static/js/bundle.js:15364:35)

    at beginWork$1 (http://localhost:3003/static/js/bundle.js:35262:11)

ERROR

post is not defined

ReferenceError: post is not defined

    at http://localhost:3003/static/js/bundle.js:400:15

    at Array.map (<anonymous>)

    at PostList (http://localhost:3003/static/js/bundle.js:398:21)

    at renderWithHooks (http://localhost:3003/static/js/bundle.js:25007:22)

    at mountIndeterminateComponent (http://localhost:3003/static/js/bundle.js:28978:17)

    at beginWork (http://localhost:3003/static/js/bundle.js:30281:20)

    at HTMLUnknownElement.callCallback (http://localhost:3003/static/js/bundle.js:15263:18)

    at Object.invokeGuardedCallbackDev (http://localhost:3003/static/js/bundle.js:15307:20)

    at invokeGuardedCallback (http://localhost:3003/static/js/bundle.js:15364:35)

    at beginWork$1 (http://localhost:3003/static/js/bundle.js:35262:11)

ERROR

post is not defined

ReferenceError: post is not defined

    at http://localhost:3003/static/js/bundle.js:400:15

    at Array.map (<anonymous>)

    at PostList (http://localhost:3003/static/js/bundle.js:398:21)

    at renderWithHooks (http://localhost:3003/static/js/bundle.js:25007:22)

    at mountIndeterminateComponent (http://localhost:3003/static/js/bundle.js:28978:17)

    at beginWork (http://localhost:3003/static/js/bundle.js:30281:20)

    at beginWork$1 (http://localhost:3003/static/js/bundle.js:35240:18)

    at performUnitOfWork (http://localhost:3003/static/js/bundle.js:34510:16)

    at workLoopSync (http://localhost:3003/static/js/bundle.js:34433:9)

    at renderRootSync (http://localhost:3003/static/js/bundle.js:34406:11)




●해결( 저것이 생략이 되어있어서 추가하라고 오류가 난것입니다.)



20240504

 

●원인

Compiled with problems:

×

ERROR

[eslint] 

src\component\list\PostList.jsx

  Line 25:27:  'post' is not defined  no-undef

  Line 27:37:  'post' is not defined  no-undef

 

src\component\ui\TextInput.jsx

  Line 18:69:  'onChange' is not defined  no-undef

 

Search for the keywords to learn more about each error.



●해결 : 오타입니다.

 

20240504

 

●원인

Compiled with problems:

×

ERROR

[eslint] 

src\component\ui\TextInput.jsx

  Line 18:69:  'onChange' is not defined  no-undef

 

Search for the keywords to learn more about each error.



●해결(오타입니다. 저 부분을 수정)

 



20240504

 

●원인(첫번째 사진이 정상인데, 두번째 사진은 비정상으로 출력되었습니다.)

 

●해결(세미콜론(상반점 ;)을 빼먹었습니다.