Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 更漂亮的扩展将使用';node_modules/prettier/index.js';验证_Visual Studio Code_Prettier_Prettier Vscode - Fatal编程技术网

Visual studio code 更漂亮的扩展将使用';node_modules/prettier/index.js';验证

Visual studio code 更漂亮的扩展将使用';node_modules/prettier/index.js';验证,visual-studio-code,prettier,prettier-vscode,Visual Studio Code,Prettier,Prettier Vscode,我的VS-code中安装了Prettier扩展。在上次更新之前,一切都很顺利,现在我有一个问题: Prettier扩展将使用'node_modules/Prettier/index.js'进行 验证,它安装在本地文件夹“my_project_folder”中。 您是否允许执行更漂亮的版本,包括所有 它将代表您加载的插件和配置文件 按“Allow Everywhere”记住所有工作区的选项 如果我拒绝,则更漂亮的格式将无法工作。 既然我已经将Prettier安装为一个扩展而不是npm软件包,为什么

我的
VS-code
中安装了
Prettier
扩展。在上次更新之前,一切都很顺利,现在我有一个问题:

Prettier扩展将使用'node_modules/Prettier/index.js'进行 验证,它安装在本地文件夹“my_project_folder”中。 您是否允许执行更漂亮的版本,包括所有 它将代表您加载的插件和配置文件

按“Allow Everywhere”记住所有工作区的选项

如果我拒绝,则
更漂亮的
格式将无法工作。
既然我已经将Prettier安装为一个扩展而不是npm软件包,为什么会提示我这样做

它是VS代码扩展,而不是一些npm包


事实恰恰相反。不是VS代码扩展。扩展是编辑器和项目中安装的更漂亮的包之间的桥梁(集成)。在不同的项目中,安装了不同版本的Prettier,因此为了确保所有协作者获得相同的格式,必须始终使用本地版本。另一方面,在VS代码中运行来自
node_modules
的代码会带来一定的安全风险(例如,想想恶意的Prettier分支),因此扩展会让用户意识到这一点。您以前没有看到此提示,因为它是最近添加的。

正如我所说,我安装了更漂亮的VS代码扩展,而不是npm包。还有
prettier
npm软件包,但到目前为止,我只使用了prettier扩展,没有在我的项目中安装该软件包。只有当您是唯一从事这些项目的人时,您的方法才是正确的。否则肯定会有格式冲突。或者你是说文件
my_project\u folder/node\u modules/prettier/index.js
实际上不存在?可能它存在是因为它是一个
node\u module
文件夹,所以即使我没有显式安装它,也可能是我安装了一些使用它的软件包,所以也安装了
prettier
软件包。但关键是之前我不需要允许任何事情,一切都很好。但是,如果我不
允许
它,格式化就不起作用。使用
node\u modules
中的版本可以很好地工作。你只是不知道而已。现在你知道了,这就是改变的地方。