March 18, 2022
화살표 함수는 익명함수에만 쓴다.
async foo () => {} 이런 식으로 쓰는 실수를 저질렀다.
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting `babel-node src/app.js`
경로/node_modules/@babel/core/lib/parser/index.js:93
throw err;
^
SyntaxError
at instantiate (경로/nodemodules/@babel/parser/lib/index.js:72:32)
at constructor (경로/nodemodules/@babel/parser/lib/index.js:358:12)
at Parser.raise (경로/nodemodules/@babel/parser/lib/index.js:3334:19)
at Parser.unexpected (경로/nodemodules/@babel/parser/lib/index.js:3372:16)
at Parser.expect (경로/nodemodules/@babel/parser/lib/index.js:4001:28)
at Parser.parseBlock (경로/nodemodules/@babel/parser/lib/index.js:15164:10)
at Parser.parseFunctionBody (경로/nodemodules/@babel/parser/lib/index.js:13864:24)
at Parser.parseFunctionBodyAndFinish (경로/nodemodules/@babel/parser/lib/index.js:13848:10) {
code: ‘BABELPARSEERROR’,
reasonCode: ‘UnexpectedToken’,
loc: Position { line: 9, column: 29, index: 242 },
pos: [Getter/Setter]
이렇게 어이 없는 실수는 에러메세지로 검색을 해도 그 메세지가 특정한 경우에만 해당되어 있지 않기 때문에 답을 찾기가 어려울 때가 많다.
실수의 원인을 알게 되면 좋지만, 그 과정에서 에너지를 과하게 소진해버릴 수 있으니 조심하자.
const foo = async () => {} 이러한 방식으로만 쓰기!
Prettier가 잘 되다가 적용되지 않는다면 prettier output log를 보자.
git clean -fdFork