Node: Suppress the node 7 Buffer DeprecationWarning for global scripts

Created on 13 Nov 2016  路  11Comments  路  Source: nodejs/node

(node:87907) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.

Shows up on the standard error every time I use certain command line tools like browserify and xlsx. I don't have write access to those node modules and hence can't change the command line scripts. Is there a way to suppress the warning that doesn't involve going back to an older version of node?

question

Most helpful comment

All 11 comments

There is both --no-deprecation to silence just deprecation warnings and --no-warnings to silence _all_ warnings (deprecation or otherwise).

@Fishrock123 @mscdex to be clear, since I currently install the modules globally to be able to use them on the command line, is the suggestion to clone the affected repos and modify the global bin scripts (e.g. https://github.com/substack/node-browserify/blob/master/bin/cmd.js for browserify) so the shebangs have --no-deprecation, then do some npm install -g on the local modules?

@spelunk Or submit a PR to the offending project to fix the Buffer usage and not have to change anything?

Use new Buffer(), or preferably Buffer.from(), Buffer.allocUnsafe() or Buffer.alloc() instead.

Is there some note regarding when each of these options is appropriate?

thx @mscdex I'll try to push modules to update

Is there a way to do this from env?

(node:7836) DeprecationWarning:

gave any solution for these warning, my node is not able connected with my mongodb server

Was this page helpful?
0 / 5 - 0 ratings

Related issues

willnwhite picture willnwhite  路  3Comments

stevenvachon picture stevenvachon  路  3Comments

akdor1154 picture akdor1154  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

addaleax picture addaleax  路  3Comments