vscode: install-extension command throws Buffer deprecated warning

Issue Type: Bug

PS C:\Users\sagavale> & 'C:\Users\sagavale\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd' --version
1.39.0
9df03c6d6ce97c6645c5846f6dfa2a6a7d276515
x64
PS C:\Users\sagavale> & 'C:\Users\sagavale\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd' --install-extension ecmel.vscode-html-css                                                                                                                            Installing extensions...
Installing extension 'ecmel.vscode-html-css' v0.2.3...
(node:336) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Extension 'ecmel.vscode-html-css' v0.2.3 was successfully installed.

I have verified that the warning does NOT occur in version 1.36.0 in which similar issue #67534 was fixed.

VS Code version: Code 1.39.0 (9df03c6d6ce97c6645c5846f6dfa2a6a7d276515, 2019-10-09T06:58:04.439Z) OS version: Windows_NT x64 10.0.19500

System Info
Item Value
CPUs Intel® Xeon® CPU E5-1650 v3 @ 3.50GHz (12 x 3492)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.91GB (7.99GB free)
Process Argv –folder-uri file:///d%3A/code/devcanvas/client/VSCodeExtension
Screen Reader no
VM 0%
Extensions (5)
Extension Author (truncated) Version
vscode-html-css ecm 0.2.3
devinsights Mic 2019.10.11-1
cpptools ms- 0.25.1
vscode-typescript-tslint-plugin ms- 1.2.2
debugger-for-chrome msj 4.12.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 27
  • Comments: 30 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@Matthew-Cherry87 @Space7Panda

It seems that just exporting one of --no-deprecation, --no-warnings, and --throw-deprecation could mute the annoying deprecation warning now.

Here is my installation script

export NODE_OPTIONS="--no-deprecation" && cat path-to-extension-list | xargs -L 1 code --install-extension

Installing extensions...
Installing extension 'casualjim.gotemplate'...
Extension 'casualjim.gotemplate' v0.4.0 was successfully installed.

@jdstraye AFAIK the deprecation warning is only a warning, and only appears when installing using the CLI or when developing extensions. I wouldn’t expect any extension to fail because of it. More likely the latest versions of some extension won’t install on your older VS Code version.

Sure, but what if you’re in an enterprise environment and want to push out Visual Studio Code + XYZ extensions to 100s or 1000s of workstations and regularly update said extensions.

From memory, the warning output also pauses the installation of extensions until the user inputs any key into the console window…

All I want is the ability to install extensions via CLI without errors/warnings/additional console windows popping up.

That’s hardly an unreasonable request.

OS: Windows 10 21H2 Version: VS Code 1.66 x64 system installation Module: ms-vcode.PowerShell-2021-12.0.vsix

Same error: (node:7368) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

This ever going to get fixed?

Pretty annoying trying to script/deploy VS Code + extensions in air-gapped environments when you can’t even install Microsoft developed and maintained extensions like PowerShell. The error pauses the CMD window and requires input to continue the extension’s installation. I’m sure I can script around it, but seriously…

It’s been present in numerous major builds of VS Code, since at least 1.39. I can say for certain it’s been present in 1.40 - 1.66.

My problem is simple but related: In the warning, it is said:

(Use Code --trace-deprecation ... to show where the warning was created)

But when i run Code --trace-deprecation ... in the terminal, there’s a new warning

Warning: 'trace-deprecation' is not in the list of known options, but still passed to Electron/Chromium. with a new code window and no other effect.

Did I do something wrong?

This is coming from yauzl module. Filed issues

thejoshwolfe/yauzl#114 andrewrk/node-fd-slicer#3

@sandy081 might it be an idea to consider replacements for these modules? They both appear to be stale and not had any code changes since prior to this issue being opened 2.5 years ago. And short of that, could this issue at least be tagged with some indicate as to why it appears to have had no movement (such as that it’s a dependency issue, and not a vscode issue)?

Almost 3 years and every extension developer still has to watch these confusing deprecation watchings. Hiding them with NODE_OPTIONS is a very dangerous thing to do as that might prevent them from spotting other similar problems that they could fix.

Any update? This is still happening. I see the deprecation warning every time the ExtensionHost starts. I also see the issue reported here when installing extensions. It’s really annoying.

Edit: I’ve managed to at least silence the error when starting the ExtensionHost for extension development with:

{
  "type": "pwa-extensionHost",
  ...
  "env": {
    "NODE_OPTIONS": "--no-deprecation"
  },
  ...
}

It appears on fd-slicer the maintainer has no interest in fixing this. Despite nearly 9 million weekly downloads.

On yauzl replacing fd-slicer with a fork fd-slicer2 has been proposed as a fix but it hasn’t been merged.

Sigh…

Tried this export NODE_OPTIONS=--throw-deprecation and did not help.