FrontEnd

node run server ์‹œ Unexpected token function ํ•ด๊ฒฐํ•  ๋•Œ ( Node version ์˜ค๋ฅ˜)

FrontEnd ๊น€ํ‰๋ฒ”๋‹˜ 2021. 8. 19. 20:22
๋ฐ˜์‘ํ˜•

Unexpected token function ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

๐ŸšซNode.js run sever ์˜ค๋ฅ˜  Unexpected token function

 

unexpected token function ์˜ค๋ฅ˜

ํ”„๋กœ์ ํŠธ๋ฅผ ๋‹ค๋ฅธ ์„œ๋ฒ„์— ์˜ฌ๋ ค์„œ run sever๋ฅผ ๋Œ๋ ค๋ดค๋Š”๋ฐ,

๋ฉ€์ฉกํ•œ ํ”„๋กœ์ ํŠธ์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

์˜ค๋ฅ˜ ๋ฐœ์ƒ ์ฝ”๋“œ๋Š” Unexpected token function

์•„์œ  ํ•˜๊ธฐ์‹ซ์–ด

์•„๋‹ˆ.. ์ž˜ ๋Œ๋˜ ํ”„๋กœ์ ํŠธ๊ฐ€ ๊ฐ‘์ž๊ธฐ ์™œ ๋ฌธ์ œ๊ฐ€ ๋˜์—ˆ๋Š”๊ฐ€

์•„๋ฌดํŠผ ๋ฐ”๋กœ ๊ตฌ๊ธ€ ์‹ ๋‹˜์—๊ฒŒ ๊ฒ€์ƒ‰์„ ํ•˜๊ณ  ํ™•์ธํ•ด๋ณด๋‹ˆ,

ํ•ด๋‹น ํ”„๋กœ์ ํŠธ๋ฅผ ๋ฐฐํฌํ•œ ์„œ๋ฒ„์˜ ๋…ธ๋“œ ๋ฒ„์ „์ด 6 ๋ฒ„์ „์ด ์„ค์น˜๋˜์–ด์žˆ์—ˆ๋‹ค.

 

node ๋ฒ„์ „ ํ™•์ธ ๋ช…๋ น์–ด

node -v

 

โœ…Unexpected token function ํ•ด๊ฒฐํ•˜๊ธฐ

ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์€ Node.js ๋ฒ„์ „์„ ์˜ฌ๋ ค์ฃผ๋ฉด ๋œ๋‹ค.

Node ํ™ˆํŽ˜์ด์ง€์— ๋“ค์–ด๊ฐ€์„œ LTS ๋ฒ„์ „์„ ์ƒˆ๋กœ ์„ค์น˜ํ•ด์ฃผ๋ฉด ๋ฐ”๋กœ ํ•ด๊ฒฐ๋œ๋‹ค.

 

์„ค์น˜๋Š” Node ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€์—์„œ ๋ฐ”๋กœ ๋‹ค์šด๋กœ๋“œํ•˜์—ฌ์„œ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค.

https://nodejs.org/ko/

 

Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

์–ด๋ ค์šด ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์ด ์•„๋‹ˆ์–ด์„œ ๋‹คํ–‰ํžˆ ์‰ฝ๊ฒŒ ๋๋‚ฌ๋‹ค.

 

 

 

๋ฐ˜์‘ํ˜•