7

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).

bad_coder
  • 8,684
  • 19
  • 37
  • 59
Ofsho
  • 71
  • 1
  • 4
  • 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? – Markus Madeja Aug 20 '20 at 09:38
  • @MarkusMadeja MacOS and yarn is installed and it is in the package.json – Ofsho Aug 20 '20 at 09:51

4 Answers4

20

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".

Eric Kim
  • 9,327
  • 4
  • 27
  • 30
5

In my case, running on macOS:

Spotted the inheritEnv option in VS Code setting.

OR

In settings.json, add this string: "terminal.integrated.inheritEnv": false

FradSer
  • 127
  • 1
  • 6
0

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".

-1

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

"files.exclude": {
  "node_modules/": true
},
VicoHu
  • 1