๐Ÿ˜Ž ๊ฐœ๋ฐœ์ž๊ฐ€ ๋งŒ์ ธ ๋ณธ ์ŠคํŒ€๋ฑ? VSCODE ํ„ฐ๋ฏธ๋„ command not found ๋ฌธ์ œ

๐Ÿ˜Ž ๊ฐœ๋ฐœ์ž๊ฐ€ ๋งŒ์ ธ ๋ณธ ์ŠคํŒ€๋ฑ? VSCODE ํ„ฐ๋ฏธ๋„ command not found ๋ฌธ์ œ
Photo by Mohammad Rahmani / Unsplash

๋‹ค๋ฅธ ์—…๋ฌด ๋•Œ๋ฌธ์— ์ตœ๊ทผ gulp ๋ฅผ ์“ธ์ผ์ด ์žˆ์–ด์„œ ๋งค์ผ๊ฐ™์ด ํœด๋Œ€ํ•˜๋Š” ์ŠคํŒ€๋ฑ์— ๊ฐ€๋ณ๊ฒŒ nodejs์™€ npm์„ ์„ค์น˜ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์—…๋ฐ์ดํŠธ ์‹œ ๊ณ ํ†ต๋ฐ›์„ ์ˆ˜๋„ ์žˆ๋Š” ๊ตฌ์กฐ์ง€๋งŒ ์–ด์จŒ๋“  ๋งค์ผ ํœด๋Œ€ํ•˜๋Š” ๊ฐœ์ธ์šฉ ๋…ธํŠธ๋ถ์œผ๋กœ๋Š” ์ŠคํŒ€๋ฑ๋งŒํ•œ๊ฒŒ ์—†๋Š” ์ƒํ™ฉ์ž…๋‹ˆ๋‹ค.

ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด Konsole์—์„œ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋“ค์„ ์„ค์น˜ํ•˜๊ณ  gulp๊นŒ์ง€ ๋„์šด ๊ฒƒ์„ ํ™•์ธํ–ˆ๋Š”๋ฐ ์ด์ƒํ•˜๊ฒŒ๋„ Konsole ๊ณผ๋Š” ๋‹ฌ๋ฆฌ VSCODE์—์„œ๋Š” npm ๋ช…๋ น์–ด๊ฐ€ ๋จน์งˆ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

"terminal.integrated.profiles.linux": {
    "bash": {
        "path": "/bin/bash",
        "icon": "terminal-bash",
        "args": [
            "-i"
        ]
    }
},
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.shellIntegration.enabled": true,

ArchLinux๊ฐ€ ์ต์ˆ™ํ•˜์งˆ ์•Š์•„ ์ฒ˜์Œ์—๋Š” ์„ค์ •์˜ ๋ฌธ์ œ์ธ๊ฐ€... ํ•˜๊ณ  ํ”ํ•˜๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์„ ๋”ฐ๋ผ๊ฐ€ ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ ํ„ฐ๋ฏธ๋„ ์„ค์ •์„ bash๋ฅผ ๋ฐ”๋ผ๋ณด๋„๋ก ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์ด์—ˆ๋Š”๋ฐ ์—ญ์‹œ๋‚˜ ํšจ๊ณผ๋Š” ์—†์—ˆ์Šต๋‹ˆ๋‹ค.

bash: npm: command not found

bash๋ฅผ ์“ฐ๋”๋ผ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋™์ผํ•œ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

์›์ธ์€ ์ •ํ™•ํžˆ ๋ชจ๋ฅด๊ฒ ์œผ๋‚˜ ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ํ•˜๊ณ  ๊ฒฉ๋ฆฌ๋œ ํ™˜๊ฒฝ์—์„œ ๋„๋Š”๊ฒŒ ์•„๋‹Œ ๊ฐ™์€ ์œ ์ €์ธ๋ฐ ์‰˜์—์„œ ๋ช…๋ น์–ด๊ฐ€ ๊ตฌ๋™์ด ์•ˆ๋œ๋‹ค๋Š” ๊ฒƒ์ด ๋„ˆ๋ฌด ์ด์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

๋งŒ์•ฝ .bashrc๋ฅผ ๋ชป๋ณธ๋‹ค ์น˜๋”๋ผ๋„ ๊ธ€๋กœ๋ฒŒ๋กœ ์„ค์น˜ํ•œ npm ๋ช…๋ น์–ด๊ฐ€ ๋จนํžˆ์งˆ ์•Š๋Š”๊ฒƒ์€ ๋„ˆ๋ฌด ์ดํ•ดํ•  ์ˆ˜ ์—†์—ˆ์Šต๋‹ˆ๋‹ค.

.bashrc ์ธก์— ๋ฌด์–ธ๊ฐ€ PATH๋ฅผ ๋ˆ„๋ฝ์‹œ์ผฐ๋‚˜ ์ƒ๊ฐํ•˜๊ธฐ๋„ ์–ด๋ ค์šด๊ฒŒ ์ด๋ฏธ Konsole์—์„œ๋Š” ๋ฌธ์ œ ์—†์ด ์ž‘๋™์„ ํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๊ตฌ๊ธ€๋ง์„ ํ•ด๊ฐ€๋ฉฐ ์ •๋ณด๋ฅผ ์ฐพ์•„๋ณด๋‹ˆ ์Šคํƒ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ์—๋„ ๋ฏผ์†์‹ ์•™์— ๊ฐ€๊นŒ์šด ๋‹ต๋ณ€๋“ค์ด ๋‚œ๋ฌดํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

PC๋ฅผ ๊ป๋‹ค๊ฐ€ ๋‹ค์‹œ ์ผœ๋ผ. ๋ผ๋˜๊ฐ€.. nodejs๋ฅผ ์ง€์šฐ๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ•ด๋ผ. nvm์œผ๋กœ ์„ค์น˜๋ฅผ ํ•ด๋ด๋ผ ๋“ฑ๋“ฑ ๋พฐ์กฑํ•œ ๋ฐฉ๋ฒ•์„ ๋ชป์ฐพ๊ณ  ํ—ค๋ฉ”๋˜ ์ฐจ์˜€์Šต๋‹ˆ๋‹ค.

์ผ๋‹จ ๋‹น์žฅ์€ ํ˜ธ์ŠคํŠธ์˜ ํ„ฐ๋ฏธ๋„์—์„œ๋Š” ์ž˜ ๋™์ž‘ํ•˜๋‹ˆ ๋ถˆํŽธํ•˜์ง€๋งŒ ํ˜ธ์ŠคํŠธ ํ„ฐ๋ฏธ๋„๋งŒ ๋„์›Œ์„œ ์“ธ๊นŒ๋„ ์ž ์‹œ ๊ณ ๋ฏผํ–ˆ์œผ๋‚˜..

๊ทธ๋ž˜๋„ ์›์ธ์€ ์ฐพ์•„๋ด์•ผ๊ฒ ๋‹ค ์‹ถ์–ด ArchLinux, VSCODE๋กœ ํ‚ค์›Œ๋“œ๋ฅผ ์žก๊ณ  ์ฐพ์•„๋ด…๋‹ˆ๋‹ค.

flatpak installed vscodeโ€™s integrated terminal not having desired behaviour ยท Issue #44 ยท flathub/com.visualstudio.code
Linux distribution and version Debian 9 strecth Flatpak version Flatpak 0.8.9 Description of the problem microsoft/vscode-cpptools#1550 The fact that the app is virtualized makes it so that you can...

๊ฒ€์ƒ‰์„ ํ•˜๋‹ค๋ณด๋‹ˆ ๋“œ๋””์–ด ์˜๋ฏธ์žˆ๋Š” FlatPaks์˜ ๊ตฌ์กฐ์— ๋Œ€ํ•ด ์•Œ๊ฒŒ๋ฉ๋‹ˆ๋‹ค.

Flatpak์˜ ์ฃผ์š” ๊ธฐ๋Šฅ์€ ์ƒŒ๋“œ๋ฐ•์‹ฑ์ด๋ฉฐ ์ด๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•  ๋ฐฉ๋ฒ•์ด ์—†์Šต๋‹ˆ๋‹ค. ํ†ตํ•ฉ ํ„ฐ๋ฏธ๋„์— ํ‘œ์‹œ๋˜๋Š” /usr ๋ฐ /bin์€ ์ž์ฒด ์‹œ์Šคํ…œ์ด ์•„๋‹Œ SDK์—์„œ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.

์œ„ ๋Œ“๊ธ€์ฒ˜๋Ÿผ ์ŠคํŒ€๋ฑ์—์„œ ์‚ฌ์šฉํ•˜๋Š” Discover ์˜ ์•ฑ๋“ค์€ ๊ฒฐ๊ตญ Flatpak์ด๋‹ˆ ๊ฒฐ๊ตญ ์ƒŒ๋“œ๋ฐ•์Šค์˜€์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‹ˆ๊นŒ VSCODE ํ„ฐ๋ฏธ๋„ ์—ญ์‹œ ์ผ์ข…์˜ ๋ณ„๋„๋กœ ๊ฒฉ๋ฆฌ๋œ ํ™˜๊ฒฝ์ด๋ผ๊ณ  ๋ณด๋Š” ๊ฒƒ์ด ๋งž์•˜์Šต๋‹ˆ๋‹ค.

์—ญ์‹œ๋‚˜ ์—†๋Š”๊ฒŒ ์—†๋Š” ๊นƒํ—ˆ๋ธŒ ์ด์Šˆ์ž…๋‹ˆ๋‹ค.

{
    "terminal.integrated.profiles.linux": {
    "Flatpak Escape": {
        "path": "flatpak-spawn",
        "args": [
            "--host",
            "toolbox",
            "run",
            "bash"
        ],
    }
    },
    "terminal.integrated.defaultProfile.linux": "Flatpak Escape"
}

์ด์ œ ์›์ธ์„ ์•Œ์•˜์œผ๋‹ˆ ๊ฐ€์žฅ ์‹ฌํ”Œํ•œ ๋ฐฉ๋ฒ•์ธ ์™ธ๋ถ€์—์„œ ์‹คํ–‰ํ•˜๋„๋ก ํƒˆ์ถœ์‹œ์ผœ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๋Œ“๊ธ€์— ๋‚˜์™€์žˆ๋Š” ๊ฐ„๋‹จํ•œ ์„ค์ • ์˜ˆ์ œ๋ฅผ ๋”ฐ๋ผ settings.json์— ์ ์šฉํ•ด๋ด…๋‹ˆ๋‹ค.

VSCODE์˜ ํ„ฐ๋ฏธ๋„์„ ๋ˆ„๋ฅด๋ฉด ์ƒˆ Konsole ์ฐฝ์ด ์—ด๋ฆฌ๊ณ  ์ˆ˜์ •ํ•˜๋˜ ์†Œ์Šค์˜ ๊ฒฝ๋กœ๋ฅผ ๋ฐ”๋ผ๋ณด๋‹ˆ ์ข€ ๋” ์‰ฝ๊ฒŒ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ด์กŒ์Šต๋‹ˆ๋‹ค.

์ผ๋‹จ gulp๋„ ์ž˜ ๋™์ž‘ํ•˜๊ณ  ์„œ๋ฒ„๋„ ์˜ฌ๋ผ์˜ค๋Š” ๊ฒƒ์ด ํ™•์ธ๋˜๊ธด ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ ์ต์ˆ™ํ•œ GUI ํ•˜๋‹จ์— ๋‚˜ํƒ€๋‚˜๋Š” ํ„ฐ๋ฏธ๋„ ๋ชจ์–‘์ด ์•„๋‹ˆ๋ผ์„œ ์ฉ ๋ณด๊ธฐ ์ข‹์€ ํ˜•ํƒœ๋Š” ์•„๋‹™๋‹ˆ๋‹ค.

์—ฌ๊ธฐ๊นŒ์ง€ ์˜ฌ ์ˆ˜ ์žˆ๋‹ค๋ฉด ๋ถ„๋ช… VSCODE ์•ˆ์ชฝ์œผ๋กœ ๋„์šธ์ˆ˜ ์žˆ๋‹ค ์‹ถ์–ด ๋Œ“๊ธ€๋“ค์„ ์ข€ ๋” ์ฐพ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์—ญ์‹œ๋‚˜ zsh๊นŒ์ง€ ๊ณ ๋ คํ•ด์„œ ์ž‘์—…ํ•ด๋‘” ๋ฆฌ๋ˆ…์Šค์šฉ ํ”„๋กœํ•„์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์˜๊ฒŒ ์ƒ‰์ƒ๊นŒ์ง€ ๋„ฃ์–ด๋‘์—ˆ๊ธธ๋ž˜ ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ๋‹ค๊ฐ€ settings.json์— ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

{
    "terminal.integrated.profiles.linux": {
        "BASH": {
            "path": "/usr/bin/flatpak-spawn",
            "args": [
                "--host",
                "--env=TERM=xterm-256color",
                "bash"
            ]
        },
        "ZSHELL": {
            "path": "/usr/bin/flatpak-spawn",
            "args": [
                "--host",
                "--env=TERM=xterm-256color",
                "zsh"
            ]
        },
        "Flatpak": {
            "path": "/bin/bash"
        }
    },
    "terminal.integrated.defaultProfile.linux": "BASH"
}

์œ„ ์„ค์ •์ฒ˜๋Ÿผ Flatpak ์™ธ๋ถ€์˜ ํ˜ธ์ŠคํŠธ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์‹คํ–‰ํ•˜๋ฉฐ ํ˜ธ์ŠคํŠธ์˜ bash, zsh,๋ณธ๋ž˜ Flatpak ํ„ฐ๋ฏธ๋„๊นŒ์ง€ ๋ชจ๋‘ ์‚ด๋ ค๋‘” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.

defaultProfile.linux

์œ„ ํ”„๋กœํ•„๋งŒ ๋ณ€๊ฒฝํ•˜๋ฉด ์–ธ์ œ๋“ ์ง€ ๋ฐ”๊ฟ”๊ฐ€๋ฉฐ ์“ธ ์ˆ˜ ์žˆ๋Š” ๊ตฌ์กฐ์ž…๋‹ˆ๋‹ค.

VSCODE์—์„œ ํ˜„์žฌ $PATH๋ฅผ ๋‚ ๋ ค๋ณด๋ฉด ์ด์ œ์„œ์•ผ ์˜์‹ฌ์Šค๋Ÿฌ์šด Flatpak ๊ฒฝ๋กœ๊ฐ€ ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

์—ญ์‹œ๋‚˜ ์„ธ์ƒ์— ๋ฐฐ์šธ๊ฒŒ ๋์ด ์—†์Šต๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ VSCODE์˜ settings.json์„ค์ •์„ ์™„๋ฃŒํ•˜๊ณ  ๋‚˜๋‹ˆ ๊น”๋”ํ•˜๊ฒŒ ์ ์šฉ๋œ ๋ชจ์Šต์ž…๋‹ˆ๋‹ค.

ํ„ฐ๋ฏธ๋„ ์ปฌ๋Ÿฌ๋„ ์ž˜ ๋จนํ˜”๊ณ  zsh๋กœ ๋ฐ”๊ฟ€๊นŒ ํ•˜๋‹ค๊ฐ€ ์˜ค์ง€๋ž–์ธ ๊ฒƒ ๊ฐ™์•„ ์ผ๋‹จ ์—ฌ๊ธฐ๊นŒ์ง€๋งŒ ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

์šฐ๋ถ„ํˆฌ์˜ apt๋‚˜ ๋ ˆ๋“œํ–‡ ๊ณ„์—ด์˜ yum์— ์ต์ˆ™ํ•˜๋‹ค ๋ณด๋‹ˆ ์—…๋ฐ์ดํŠธ๊ฐ€ ํŽธ๋ฆฌํ•  ๊ฒƒ ๊ฐ™์•„ ๊ณ ์ง‘ํ•˜๋˜ Flatpak์ด ์ด๋Ÿฐ ํŠน์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”์ง€๋Š” ์ฒ˜์Œ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.

ArchLinux๊ฐ€ ๊ทธ๋ž˜๋„ ์ข‹๋‹ค ์ข‹๋‹ค ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์ด ๋งŽ์•„์„œ ๋ผ์ฆˆ๋ฒ ๋ฆฌ ํŒŒ์ด์—์„œ ์ž ๊น ๊ฐ€์ง€๊ณ  ๋†€๋˜ ๋งŒ์ž๋กœ ๋ฆฌ๋ˆ…์Šค๋ณด๋‹ค๋Š” ํŽธํ• ๊ฒƒ ๊ฐ™์•˜๋Š”๋ฐ ์ƒ๊ฐ๋ณด๋‹ค ์‰ฝ์ง€ ์•Š์€ ๊ตฌ์กฐ์˜€์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿผ์—๋„ ๊ฐ„๋‹จํ•œ ๊ฐœ๋ฐœ์—๋Š” ์—ญ์‹œ ๋ฆฌ๋ˆ…์Šค๋กœ๋„ ์ถฉ๋ถ„ํ•œ๋ฐ๋‹ค๊ฐ€ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ๋„ ๊ฒฐ๊ตญ ๋ฆฌ๋ˆ…์Šค๋ผ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐ์ด ๋˜๊ธด ํ•˜๋Š”๊ตฐ์š”. :)

๋น„์ •๊ธฐ๋กœ ๋ฐœํ–‰๋˜๋Š” ์ถ”์ฒœ ํฌ์ŠคํŠธ๋ฅผ ์ด๋ฉ”์ผ๋กœ ๋ฐ›์•„ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŠน๋ณ„ํ•œ ์ถ”์ฒœ ํฌ์ŠคํŠธ๋ฅผ ๋ฐ”๋กœ ์ด๋ฉ”์ผ๋กœ ๋ฐ›์•„๋ณด์„ธ์š”. ๋ฌผ๋ก  ๋ฌด๋ฃŒ์ž…๋‹ˆ๋‹ค!
์ข‹์•„์š”! ๋ฐ›์€ ํŽธ์ง€ํ•จ์„ ํ™•์ธํ•˜๊ณ  ๊ตฌ๋…์„ ํ™•์ธํ•˜๋ ค๋ฉด ๋งํฌ๋ฅผ ํด๋ฆญํ•˜์‹ญ์‹œ์˜ค.
์˜ค๋ฅ˜! ์œ ํšจํ•œ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์ž…๋ ฅํ•˜์‹ญ์‹œ์˜ค!