🤍 전 강의 25% 할인 중 🤍

2024년 상반기를 돌아보고 하반기에도 함께 성장해요!
인프런이 준비한 25% 할인 받으러 가기 >>

  • 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

VueJS 에서 (7) npm run serve 라고 치면 Error가 떠요

22.10.20 00:17 작성 조회수 1.33k

0

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

터미널창에

User@DESKTOP-RE18OV4 MINGW64 ~/Desktop/saju/saju-frontend-vuejs

$ npm run serve

> saju-frontend-vuejs@0.1.0 serve

> vue-cli-service serve

INFO Starting development server...

98% after emitting CopyPlugin

ERROR Failed to compile with 1 error 오전 12:13:47

Syntax Error: TypeError: Cannot read properties of undefined (reading 'parseComponent')

You may use special comments to disable some warnings.

Use // eslint-disable-next-line to ignore the next line.

Use /* eslint-disable */ to ignore all warnings in a file.

계속 이렇게 떠서 그냥 넘어가서 다음 과정인 크롬에 http://localhost:8080/ 을 입력하면

Failed to compile.

./src/App.vue Module Error (from ./node_modules/vue-loader/lib/index.js): Vue packages version mismatch: - vue@2.7.10 (C:\Users\User\Desktop\saju\saju-frontend-vuejs\node_modules\vue\dist\vue.runtime.common.js) - vue-template-compiler@2.6.11 (C:\Users\User\Desktop\saju\saju-frontend-vuejs\node_modules\vue-template-compiler\package.json) This may cause things to work incorrectly. Make sure to use the same version for both. If you are using vue-loader@>=10.0, simply update vue-template-compiler. If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

이렇게 떠요ㅠㅠ 뭐가 문제인가요??

답변 1

답변을 작성해보세요.

1

안녕하세요.

vuejs 버전 문제가 있었습니다.

아래 내용으로 구글에서 검색 후 스택오버플로우에서 해결책을 찾았습니다.

Syntax Error: TypeError: Cannot read properties of undefined (reading 'parseComponent')

https://stackoverflow.com/questions/59867434/every-vue-component-returning-cannot-read-property-parsecomponent-of-undefined

 

해결책

  1. node_modules 폴더를 삭제합니다.

  2. package.json 에서 변경이 필요합니다.

"vue-template-compiler": "2.6.11" (변경 전 ^2.6.11)

"vue": "2.6.11" (변경 전 ^2.6.11)

3. npm install 이후 npm run serve

 

현재 github에는 수정된 코드로 변경하였습니다.

앞으로 더 꼼꼼히 검토 하겠습니다. 감사합니다.

채널톡 아이콘