Ofs*_*sho 1 build node.js typescript visual-studio-code yarnpkg
我想从源代码构建 VSCode,但出现此错误:
The terminal process "/bin/zsh '-c', 'yarn run watch-extensionsd'" failed to launch (exit code: 127).
Fra*_*Ser 11
在 macOS 上,我通过在 VS Code 设置中找到该inheritEnv选项来解决这个问题。
或者,您可以将此行包含在您的settings.json:中"terminal.integrated.inheritEnv": false。
小智 6
与上述相关,如果 macOS 和您的计算机最近自行重新启动(例如,内核恐慌),我发现 VScode 重新加载不正确,而没有在之前打开的所有终端中加载环境。
修复方法很简单,完全关闭 VSCode,然后重新启动。然后环境将正确加载。
问题是你在 vscode 中的 npm 脚本以/bin/zsh -c(非登录非交互式)开始,这意味着 ~/.zshrc 中的脚本没有被执行(出于同样的原因 ~/.zprofile)。然而,即使在非登录非交互模式下, ~/.zshenv 也会被加载。
解决方案1:
Change "npm.packageManager": to npm
Make sure you restart vscode to make this take into effect.
Run Code Online (Sandbox Code Playgroud)
解决方案2(首选):
Open ~/.zshrc and move whatever scripts that is loading yarn into ~/.zshenv
Run Code Online (Sandbox Code Playgroud)
在我的特定情况下,我的纱线是通过 npm 安装的,npm i -g yarn而我的 npm 是通过 nvm 安装的。所以我不得不沿着两条线移动。
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Run Code Online (Sandbox Code Playgroud)
解决方案3:
不要使用 VSCode 的 npm 脚本。您实际上可以通过自己打开终端快捷键 ctrl + ` 并输入 yarn “npm 脚本名称”来执行。
| 归档时间: |
|
| 查看次数: |
2042 次 |
| 最近记录: |