inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

비전공자를 위한 진짜 입문 올인원 개발 부트캠프

상품 생성, 조회 API 구현

node server.js 명령어를 입력하면 오류가 나옵니다

292

qkqh0790

작성한 질문수 2

1

SyntaxError: Unexpected string in JSON at position 49

    at JSON.parse (<anonymous>)

    at parse (C:\Users\김성범\Desktop\cap-server\node_modules\body-parser\lib\types\json.js:89:19)

    at C:\Users\김성범\Desktop\cap-server\node_modules\body-parser\lib\read.js:121:18

    at invokeCallback (C:\Users\김성범\Desktop\cap-server\node_modules\raw-body\index.js:224:16)

    at done (C:\Users\김성범\Desktop\cap-server\node_modules\raw-body\index.js:213:7)

    at IncomingMessage.onEnd (C:\Users\김성범\Desktop\cap-server\node_modules\raw-body\index.js:273:7)

    at IncomingMessage.emit (events.js:327:22)

    at endReadableNT (internal/streams/readable.js:1327:12)

    at processTicksAndRejections (internal/process/task_queues.js:80:21)

QUERY :  {}

QUERY :  {}

머신러닝 배워볼래요? react-native HTML/CSS tensorflow express javascript nodejs react

답변 1

0

그랩

49번째 줄에 JSON이 제대로 들어오지 않는 문제같아요.

JSON.parse를 할 때 안에 들어가는 string 값이 JSON 형식에 맞게 적혀져 있어야 합니다!

JSON.parse 안에 들어갈 값을 console.log로 찍어서 먼저 확인해보세요 :)

안되시면 소스코드와 로그 남겨주시구요.

0

qkqh0790

소스코드

  try {
      debug('parse json')
      return JSON.parse(body, reviver)
    } catch (e{
      throw normalizeJsonSyntaxError(e, {
        message: e.message,
        stack: e.stack
      })
    }
  }
오류 ctrl + click 하니까 이렇게 나와있는데 뭘 수정해야할지 모르겠습니다
오류메세지는 똑같이 나옵니다

[해결]그랩님 답변 주세요.

0

159

2

그랩님의 답변을 기다립니다/102강 전반적인 에러

0

139

2

[그랩님께]101강 안드로이드 에러들(Key prop)해결방법 궁금합니다.

0

122

2

[재질문][그랩님 답변 부탁드립니다]101강

0

135

2

[그랩님 답변 부탁드립니다]101강 Axios 에러와 502 Bad Gateway 질문

0

96

2

Ngrok 설치 후 forwarding Url 에러

0

129

2

[그랩님께,Ngrok 악성코드 인식 해결방법]질문 드립니다.

0

213

2

Ngrok 설치 후 forwarding Url로 연결 불가

0

133

1

그랩님,[꼭] 답변 부탁드립니다.

0

64

1

[꼭][[꼭] 그랩님, 답변 부탁드립니다], Failed to load resource: the server responded with a status of 404 (Not Found) 상품 상세 페이지 질문입니다.

0

145

1

6강/7강 수업

0

49

1

그랩님, 상품 상세 페이지 에러와 의문점 질문드립니다.

0

98

2

그랩님, 해결되지 않은 에러 메시지 [꼭] 답변 부탁 드립니다.

0

133

2

[재 질문]Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?

0

88

1

Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?

0

126

2

일반적인 css 꾸미기에서 width와 height의 값?

0

86

2

Windows에서의 업로드 후 홈화면 상품이미지 오류 해결방법

0

191

1

그랩마켓 웹화면 구현하기 -2 질문입니다.

0

118

1

react에 반영이 되지 않습니다.

0

233

1

터미널 npm install -g create-react-app 작성 후 오류

0

418

1

create-react-app my app 실행 시 에러

0

349

2

포스트맨 질문

0

93

1

<꼭 답변 부탁 드립니다>그랩선생님, [컴포넌트 사용하기] 강의에서 질문 있습니다.

0

255

2

그랩선생님, 질문 답변 부탁 드립니다.vscode에서 npm install -g create-react-app 입력 후 에러 입니다.

0

468

2