๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Lect & Tip/vscode

๋ฆฌ์•กํŠธ vscode Failed to load jshint library. ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ•

by ๋‚ฏ์„ ๊ณต๊ฐ„2019 2021. 8. 6.

๋ชฉ์ฐจ

    ๋ฆฌ์•กํŠธ VSCode "Failed to load jshint library" ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ•

    ์„œ๋ก 

    ์ตœ๊ทผ์— ์ƒˆ๋กœ์šด ๋…ธํŠธ๋ถ์— Visual Studio Code (VSCode)๋ฅผ ์„ค์น˜ํ•˜๊ณ , ๋ฆฌ์•กํŠธ๋ฅผ ๊ฐœ๋ฐœํ•˜๋˜ ์ค‘ "Failed to load jshint library. Please install jshint in your workspace folder using 'npm install jshint' and then press Retry." ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๊ฐ€ ์ถœ๋ ฅ๋˜๋Š” ์ƒํ™ฉ์„ ๊ฒช์—ˆ์Šต๋‹ˆ๋‹ค. ์ฒ˜์Œ์—๋Š” ์ธํ„ฐ๋„ท์—์„œ ๋งŽ์ด ๋‚˜์˜ค๋Š” ๋Œ€๋กœ jshint๋ฅผ ์„ค์น˜ํ•˜๋ ค๊ณ  ์‹œ๋„ํ–ˆ์ง€๋งŒ, ๊ทธ ๊ฒฐ๊ณผ ์—„๊ฒฉํ•œ ๊ฒฝ๊ณ ์™€ ๋ถˆํ•„์š”ํ•œ ๊ฐ„์„ญ์„ ๊ฒช๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ์ด ๋ฌธ์ œ์˜ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

    ๋ณธ๋ก 

    VSCode์—์„œ ์ด "Failed to load jshint library" ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ์ด์œ ๋Š”, ๊ธฐ๋ณธ์ ์œผ๋กœ VSCode๊ฐ€ ๋‚ด์žฅํ•˜๊ณ  ์žˆ๋Š” jshint์™€ ์‚ฌ์šฉ์ž๊ฐ€ ์ „์—ญ์œผ๋กœ ์„ค์น˜ํ•œ jshint ๊ฐ„์˜ ์ถฉ๋Œ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

    The extension looks for a jshint module in the current directory and in the global package location.

    ์ด๋กœ ์ธํ•ด JSX ๋ฌธ๋ฒ•์ด๋‚˜ ES6 ๋ฌธ๋ฒ•์„ ํฌํ•จํ•œ ์ผ๋ฐ˜์ ์ธ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ์— ๋Œ€ํ•ด์„œ๋„ ์ง€๋‚˜์น˜๊ฒŒ ์—„๊ฒฉํ•œ ๊ฒฝ๊ณ ์™€ ๊ทœ์น™์ด ์ ์šฉ๋˜์–ด ๊ฐœ๋ฐœ ํŽธ์˜์„ฑ์ด ๋–จ์–ด์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

    ๋‚ด๊ฐ€ ์ˆœ์ˆ˜ํ•œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋‹ค๋ฉด ๋ชจ๋ฅผ๊นŒ, ๋ฆฌ์•กํŠธ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด JSX๋ฌธ๋ฒ•์— ๋Œ€ํ•ด์„œ ๊ฐ„์„ญํ•˜๊ธฐ ์‹œ์ž‘ํ•˜๊ณ  ์‹ฌ์ง€์–ด๋Š” ES6 ๋ฌธ๋ฒ•์— ๋Œ€ํ•ด์„œ๋„ "๋„ˆ ๊ทธ๋ ‡๊ฒŒ ์“ฐ๋ฉด ์•ˆ ๋ผ!"๋ฅผ ์—ฐ๋ฐœํ•ด๋Œ„๋‹ค.

    ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

    1. jshint Uninstall
      • ๊ธฐ๋ณธ์ ์œผ๋กœ ์„ค์น˜๋œ jshint๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค. ํ„ฐ๋ฏธ๋„์—์„œ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
        npm uninstall jshint -g
      • ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด jshint๊ฐ€ ์ „์—ญ์—์„œ ์‚ญ์ œ๋˜๋ฉฐ, VSCode์˜ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์—์„œ ๋” ์ด์ƒ jshint๋ฅผ ์ฐพ์ง€ ๋ชปํ•ด "Failed to load jshint library" ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
    2. ESLint ์‚ฌ์šฉ
      • jshint ๋Œ€์‹  ESLint๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋” ํŽธ๋ฆฌํ•˜๊ฒŒ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ๊ฒ€์‚ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ESLint๋Š” ํ™•์žฅ์„ฑ์ด ๋›ฐ์–ด๋‚˜๊ณ , ์ปค์Šคํ„ฐ๋งˆ์ด์ง•์ด ์šฉ์ดํ•œ ๋„๊ตฌ๋กœ์„œ ๋‹ค์–‘ํ•œ ํ”„๋กœ์ ํŠธ์— ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
      • ESLint๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด ํ”„๋กœ์ ํŠธ ํด๋”์—์„œ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
        npm install eslint --save-dev
      • VSCode ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์—์„œ ESLint๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ ์„ค์น˜ํ•˜๊ณ , ํ”„๋กœ์ ํŠธ์— ๋งž๋Š” ๊ทœ์น™์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
    3. VSCode ์„ค์ • ๋ณ€๊ฒฝ
      • VSCode์—์„œ ESLint๋ฅผ ๊ธฐ๋ณธ Linter๋กœ ์„ค์ •ํ•˜๋ฉด "Failed to load jshint library" ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์„ค์ • ๋ณ€๊ฒฝ์„ ์œ„ํ•ด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.
      • ๋จผ์ €, VSCode ์„ค์ •์œผ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. (File -> Preferences -> Settings)
      • ๊ฒ€์ƒ‰ ์ฐฝ์—์„œ "eslint.validate"๋ฅผ ์ž…๋ ฅํ•˜๊ณ , "Edit in settings.json"์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
      • "eslint.validate": "javascript" ๋ผ์ธ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ์—๋งŒ ESLint๊ฐ€ ์ ์šฉ๋˜๋„๋ก ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. (๊ธฐ๋ณธ์ ์œผ๋กœ .js ํŒŒ์ผ์—๋งŒ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค)
      • ์„ค์ •์„ ์ €์žฅํ•˜๊ณ  VSCode๋ฅผ ์žฌ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

    ๊ฒฐ๋ก 

    "Failed to load jshint library" ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด jshint๋ฅผ ๊ฐ•์ œ๋กœ ์„ค์น˜ํ•˜๋Š” ๊ฒƒ์€ ์ง€์–‘ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋Œ€์‹ , jshint๋ฅผ ์‚ญ์ œํ•˜๊ณ  ESLint๋กœ ๋Œ€์ฒดํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

    ๊ตณ์ด ์„ค์น˜๋ผ ์žˆ๋Š” JShint๋ฅผ Uninstallํ•  ํ•„์š”๋Š” ์—†๋‹ค. ๋‹ค๋งŒ, disabled๋ฅผ ์‹œ์ผœ์ค„ ๋ฟ์ด๋‹ค.

    ESLint๋Š” ๋” ๋งŽ์€ ํ™•์žฅ์„ฑ๊ณผ ์ปค์Šคํ„ฐ๋งˆ์ด์ง• ๊ฐ€๋Šฅ์„ฑ์„ ์ œ๊ณตํ•˜๋ฉฐ, ๊ฐœ๋ฐœ์ž๋“ค์ด ๋” ํšจ์œจ์ ์ด๊ณ  ํŽธ๋ฆฌํ•˜๊ฒŒ ์ฝ”๋“œ๋ฅผ ๊ฒ€์‚ฌํ•˜๊ณ  ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค.

    ์ฐธ๊ณ  ์ž๋ฃŒ


    ์ด ํฌ์ŠคํŒ…์—์„œ๋Š” "Failed to load jshint library" ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ jshint๋ฅผ ์‚ญ์ œํ•˜๊ณ , ESLint๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๊ถŒ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋กœ์จ ๊ฐœ๋ฐœํ™˜๊ฒฝ์—์„œ ๋ณด๋‹ค ์›ํ™œํ•˜๊ฒŒ ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ESLint๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์ฝ”๋“œ ํ’ˆ์งˆ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ณ , ๋ถˆํ•„์š”ํ•œ ๊ฒฝ๊ณ ๋ฅผ ์ตœ์†Œํ™”ํ•˜๋ฉฐ, ๊ฐœ๋ฐœ์ž๋“ค์ด ๋” ๋‚˜์€ ๊ฐœ๋ฐœ ๊ฒฝํ—˜์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ๋ฐ˜์‘ํ˜•

    ๋Œ“๊ธ€