VSCODE build error `The terminal process "/bin/zsh '-c', 'yarn run watch-extensionsd'" failed to launch (exit code: 127).`
Asked Answered
I

6

19

I want to build VSCode from source and I get this error:

The terminal process "/bin/zsh '-c', 'yarn run watch-extensionsd'" failed to launch (exit code: 127).

Indistinctive answered 20/8, 2020 at 9:33 Comment(2)
Hi, do you use MacOs or Linux with zsh? Is yarn installed? Do you have the script "watch-extensionsd' (including the d at the end) in the package.json?Wondawonder
@MarkusMadeja MacOS and yarn is installed and it is in the package.jsonIndistinctive
I
46

The problem is your npm scripts in vscode is started with /bin/zsh -c (non-login non-interactive) This means scripts inside ~/.zshrc is not executed (and for the same reason ~/.zprofile). However, even in non-login non-interactive mode, ~/.zshenv is loaded.

Solution 1:

Change "npm.packageManager": to npm
Make sure you restart vscode to make this take into effect.

Solution 2 (preferred):

Open ~/.zshrc and move whatever scripts that is loading yarn into ~/.zshenv

In my specific case, my yarn is installed through npm npm i -g yarn and my npm is installed through nvm. So I had to move following two lines.

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

Solution 3:

Don't use VSCode's npm scripts. You can actually execute by opening terminal yourself shortcut ctrl + ` and typing out yarn "npm script name".

Inveigh answered 15/12, 2020 at 10:34 Comment(2)
create a ~/.zshenv add a line source ~/.zshrcHuh
solution 2 works like a charm on linux, thank youTjon
O
12

On macOS, I addressed this by locating the inheritEnv option in VS Code settings.

Alternatively, you can include this line in your settings.json: "terminal.integrated.inheritEnv": false.

Out answered 1/2, 2021 at 5:15 Comment(2)
Thanks! This works for me for a similar problem!Pember
Would you please elaborate your answer? In settings.json, add this string: "terminal.integrated.inheritEnv": falseArabia
A
6

Related to the above, if macOS and your computer recently restarted on its own (e.g., kernel panic), I found that VScode reloads improperly without loading the environment in all Terminals that were open prior.

The fix is simply to close out of VSCode completely, then relaunch. The environments will then load properly.

Armillia answered 11/1, 2023 at 0:42 Comment(0)
B
3

It happens that ~/.zshrc is not sourced when VS Code is launched from the application menu but if it is launched from a terminal it works perfectly. So what I did is, I changed the command of Exec field in the desktop entry file (/usr/local/applications/code.desktop or ~/.local/share/applications/code.desktop) to zsh -c "source $HOME/.zshrc && code".

Butene answered 18/3, 2022 at 7:57 Comment(0)
M
1

For me, it's happening when I try to use nx plugin for VS Code. So the only thing I needed to do is restart VS Code and it's working again.

Millburn answered 1/8, 2023 at 18:9 Comment(0)
B
-2

In my case,
I just commented out a setting in VS Code. It works.

"files.exclude": {
  "node_modules/": true
},
Bennie answered 18/3, 2021 at 13:44 Comment(1)
This above did not work for me.Eisenberg

© 2022 - 2024 — McMap. All rights reserved.