“代码".在OSX/Mac上的Visual Studio Code的命令行中不起作用 [英] "code ." Not working in Command Line for Visual Studio Code on OSX/Mac

查看:498
本文介绍了“代码".在OSX/Mac上的Visual Studio Code的命令行中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

命令代码".在本手册中不起作用?

The command "code ." doesn't work in this manual?

在此之前所有其他步骤均有效.如何在OSX终端中调用Visual Studio代码?

All the other steps before that worked. How can I call the Visual Studio Code in OSX terminal?

Monas-MacBook-Pro:myExpressApp mona$ pwd
/Users/mona/nodejs/myExpressApp
Monas-MacBook-Pro:myExpressApp mona$ code .
-bash: code: command not found

我最终通过更改工作区从Visual Code Studio中打开了它,但是我想知道为什么该命令"code".不行吗

I ended up opening it from within Visual Code Studio by changing the workspace but I am wondering why that command "code ." won't work?

推荐答案

1.确保将Visual Studio Code应用程序拖动到-Applications-文件夹中

否则(如注释中所述),重新启动后,您将不得不再次执行此过程

通过(⇧⌘P)打开命令面板,然后键入shell command查找Shell命令:

Open the Command Palette via (⇧⌘P) and type shell command to find the Shell Command:

执行命令后,为新的$ PATH重新启动终端 价值生效.您只需输入"code"即可.在任何 文件夹开始编辑该文件夹中的文件.这 "."简而言之就是当前目录"

After executing the command, restart the terminal for the new $PATH value to take effect. You'll be able to simply type 'code .' in any folder to start editing files in that folder. The "." Simply means "current directory"

(来源: VS代码文档 )

这篇关于“代码".在OSX/Mac上的Visual Studio Code的命令行中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆