Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress the node 7 Buffer DeprecationWarning for global scripts #9589

Closed
spelunk opened this issue Nov 13, 2016 · 11 comments
Closed

Suppress the node 7 Buffer DeprecationWarning for global scripts #9589

spelunk opened this issue Nov 13, 2016 · 11 comments
Labels
question Issues that look for answers.

Comments

@spelunk
Copy link

spelunk commented Nov 13, 2016

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

@Fishrock123
Copy link
Contributor

--no-deprecation

@Fishrock123 Fishrock123 added the question Issues that look for answers. label Nov 13, 2016
@mscdex
Copy link
Contributor

mscdex commented Nov 13, 2016

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

@spelunk
Copy link
Author

spelunk commented Nov 13, 2016

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

@mscdex
Copy link
Contributor

mscdex commented Nov 13, 2016

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

@spelunk
Copy link
Author

spelunk commented Nov 13, 2016

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?

@spelunk
Copy link
Author

spelunk commented Nov 13, 2016

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

@sam-github
Copy link
Contributor

See #9483

@kilianc
Copy link

kilianc commented Aug 16, 2018

Is there a way to do this from env?

@naveen1497
Copy link

(node:7836) DeprecationWarning:

@naveen1497
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

6 participants