microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.27k stars 28.57k forks source link

install-extension command throws Buffer deprecated warning #82524

Closed samrat-gavale closed 6 months ago

samrat-gavale commented 4 years ago

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(R) Xeon(R) 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
tristanbarcelon commented 4 years ago

1.40.2 still has this error as well when installing following extensions: formulahendry.code-runner, formulahendry.auto-close-tag, formulahendry.dotnet-test-explorer, formulahendry.docker-explorer, vsciot-vscode.azure-iot-tools, vsciot-vscode.azure-iot-edge, eamodio.gitlens, and a few others. It does appear to be a built-in problem within vscode when installing extensions via cli.

sandy081 commented 4 years ago

@bpasero @deepak1556

I am not able to see these warning when running from sources. Also I have not changed any node dependencies from 1.36. I was clue less from where these warnings are coming from. Any help would be appreciated.

bpasero commented 4 years ago

@sandy081 maybe try this:

From now on you should see stacktraces where the offender is coming from. Alternatively, if we know the extension that is causing this, try to find the deprecated usages of the Buffer constructor.

sandy081 commented 4 years ago

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

bpasero commented 4 years ago

@sandy081

~/Development/Microsoft/monaco> code --install-extension ecmel.vscode-html-css  
Installing extensions...
Installing extension 'ecmel.vscode-html-css' v0.2.3...
internal/process/warning.js:127
      throw warning;
      ^

DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:156:11)
    at new Buffer (buffer.js:171:3)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/fd-slicer/index.js:109:18
    at pendGo (/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/pend/index.js:54:3)
    at onCb (/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/pend/index.js:41:7)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/fd-slicer/index.js:31:7
    at FSReqCallback.wrapper [as oncomplete] (fs.js:477:5) {
  name: 'DeprecationWarning',
  code: 'DEP0005'
}
sandy081 commented 4 years ago

Yes running out of source did not work. Tried on insiders and I can see the error now.

Thanks.

sandy081 commented 4 years ago

This is coming from yauzl module. Filed issues

https://github.com/thejoshwolfe/yauzl/issues/114 https://github.com/andrewrk/node-fd-slicer/issues/3

ctf0 commented 4 years ago

am having the same issue but on usage ex.https://github.com/fabiospampinato/vscode-open-multiple-files

however it show on first run only.

ArturoDent commented 3 years ago

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

squidfunk commented 2 years ago

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"
  },
  ...
}
PabloLION commented 2 years ago

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?

ArturoDent commented 2 years ago

@Pablion see https://stackoverflow.com/a/68413237/836330 on how to use the trace option.

PabloLION commented 2 years ago

Thank you @ArturoDent. I'll try it tomorrow.

hsinyinfu commented 2 years ago

The same problem still exists in the latest 1.62.2 version. I just double-clicked the VSCode icon to open it, new a terminal, and the Buffer() error was printed in the Log(Window) view. The VSCode I opened for testing is a fresh 1.62.2 portable VSCode with 0 extension installed. (The 1.62.2 installation VSCode showed the same error message as well)

[2021-11-12 10:41:06.693] [renderer1] [info] Starting extension host with pid 21444. [2021-11-12 10:41:06.693] [renderer1] [info] [LocalProcessExtensionHost]: IExtensionHostStarter.start() took 1029 ms. [2021-11-12 10:41:07.071] [renderer1] [error] [Extension Host] (node:21444) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use Code --trace-deprecation ... to show where the warning was created)

space7panda commented 2 years ago

got same issue

code --install-extension .\TheUltimateDartMonkey.ide-0.0.1.vsix
Installing extensions...
(node:19100) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
squidfunk commented 2 years ago

npm 8 allows for overriding transitive dependencies, so maybe that's an option if the original author doesn't respond and it's too time-consuming to replace the immediate dependency causing the trouble. We could set it to a fork with a fix.

Matthew-Cherry87 commented 2 years ago

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.

abjutus commented 2 years ago

@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.
ssbarnea commented 2 years ago

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.

corbob commented 2 years ago

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

sandy081 commented 2 years ago

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.

That's a good idea. Will look into that.

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

Thanks, added upstream-issue-linked label

jdstraye commented 2 years ago

I am trying to install 23 extensions so that I have similar work environments without VPN (Windows) and with VPN (Linux). I have observed that all 23 extensions install fine on Windows with

Version: 1.68.1 (system setup)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:48:58.283Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19044

But I can only install 3 extensions on Linux with

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:39:46.686Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 4.12.14-122.60-default
gjsjohnmurray commented 2 years ago

@jdstraye your issue is unlikely to be related to this one. More likely the extensions require a more recent version of VS Code than the 1.63.2 your Linux environment has.

jdstraye commented 2 years ago

@gjsjohnmurray, 100% agree that my company's Linux version is woefully behind, and many of the issues are related to that. But, it has definitely run into the deprecated buffer() error as well. I was hoping these 2 clues would be helpful: Windows vs. Linux and v1.63.2 vs 1.68.1. If more details would be helpful (e.g., which extension fail with "buffer() deprecated" on 1.63.2 Linux), let me know. My company's connection to extensions on Linux is also woefully slow. It would help if there was a way to download all the .vsix files that you were interested in and try them on CLI.

gjsjohnmurray commented 2 years ago

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

Matthew-Cherry87 commented 2 years ago

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

Reemh commented 2 years ago

Is it possible that this warning is happening only when you have vsce as a devDependencies in the extension? Those problematic packages are used by the vsce. Our code is not really using any package that depends on fd-slicer nor yauzl.

alfadormx commented 1 year ago

Issue detected again in the following version:

Version: 1.79.2 (user setup)
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:57:04.379Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22621

Here are the Windows Terminal traces of my script executing the command:

Installing extensions...
Installing extension 'ms-azuretools.vscode-docker'...
(node:7476) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'ms-azuretools.vscode-docker' v1.25.1 was successfully installed.
Installing extensions...
Installing extension 'mhutchie.git-graph'...
(node:8748) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'mhutchie.git-graph' v1.30.0 was successfully installed.
Installing extensions...
Installing extension 'bradlc.vscode-tailwindcss'...
(node:7412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'bradlc.vscode-tailwindcss' v0.9.11 was successfully installed.
Installing extensions...
Installing extension 'esbenp.prettier-vscode'...
(node:8500) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'esbenp.prettier-vscode' v9.13.0 was successfully installed.
Installing extensions...
Installing extension 'csstools.postcss'...
(node:9548) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'csstools.postcss' v1.0.9 was successfully installed.
Installing extensions...
Installing extension 'pkief.material-icon-theme'...
(node:9276) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'pkief.material-icon-theme' v4.28.0 was successfully installed.
Installing extensions...
Installing extension 'ms-vscode.vscode-typescript-next'...
(node:9264) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'ms-vscode.vscode-typescript-next' v5.2.20230617 was successfully installed.
Installing extensions...
Installing extension 'dbaeumer.vscode-eslint'...
(node:6252) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Extension 'dbaeumer.vscode-eslint' v2.4.0 was successfully installed.
ghost commented 1 year ago

Same as above:

1.81.1
6c3e3dba23e8fadc360aed75ce363ba185c49794
x64

code-tunnel.exe

code-tunnel ext install C:\Users\me\Downloads\ms-vscode-remote.remote-ssh-0.106.2023082115.vsix
Installing extensions...
(node:13536) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Error: Unable to install extension 'ms-vscode-remote.remote-ssh' as it is not compatible with VS Code '1.81.1'.
    at T.install (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:4827)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async y.g (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:28:299)
    at async C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:27:16258
    at async Promise.all (index 0)
    at async y.installExtensions (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:27:16187)
    at async C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:25209
    at async Object.me [as main] (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:28810)
    at async w (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:14:22007)
Failed Installing Extensions: file:///c%3A/Users/sfdahe/Downloads/ms-vscode-remote.remote-ssh-0.106.2023082115.vsix
 sfdahe  code --install-extension C:\Users\sfdahe\Downloads\ms-vscode-remote.remote-ssh-0.106.2023082115.vsix

code.exe

code --install-extension C:\Users\me\Downloads\ms-vscode-remote.remote-ssh-0.106.2023082115.vsix
Installing extensions...
(node:42776) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Error: Unable to install extension 'ms-vscode-remote.remote-ssh' as it is not compatible with VS Code '1.81.1'.
    at T.install (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:4827)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async y.g (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:28:299)
    at async C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:27:16258
    at async Promise.all (index 0)
    at async y.installExtensions (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:27:16187)
    at async C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:25209
    at async Object.me [as main] (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:50:28810)
    at async w (C:\Users\sfdahe\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cli.js:14:22007)
Failed Installing Extensions: file:///c%3A/Users/sfdahe/Downloads/ms-vscode-remote.remote-ssh-0.106.2023082115.vsix
yous commented 9 months ago

On Windows:

C:\> code --version
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64
C:\> set NODE_OPTIONS="--trace-deprecation"
C:\> code --install-extension ms-vscode.cpptools-1.19.1@win32-x64.vsix
Installing extensions...
(node:924) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (node:buffer:198:11)
    at new Buffer (node:buffer:282:3)
    at C:\Users\yous\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\fd-slicer\index.js:109:18
    at pendGo (C:\Users\yous\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\pend\index.js:54:3)
    at onCb (C:\Users\yous\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\pend\index.js:41:7)
    at C:\Users\yous\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\fd-slicer\index.js:31:7
    at FSReqCallback.wrapper [as oncomplete] (node:fs:684:5)
Extension 'ms-vscode.cpptools-1.19.1@win32-x64.vsix' was successfully installed.