镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Suppress the node 7 Buffer DeprecationWarning for global scripts #9589

Closed

Description

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

Activity

  1. Fishrock123 commented on Nov 13, 2016

    @Fishrock123
    Contributor
  2. mscdex commented on Nov 13, 2016

    @mscdex
    Contributor

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

  3. spelunk commented on Nov 13, 2016

    @spelunk
    Author

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

  4. mscdex commented on Nov 13, 2016

    @mscdex
    Contributor

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

  5. spelunk commented on Nov 13, 2016

    @spelunk
    Author

    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?

  6. spelunk commented on Nov 13, 2016

    @spelunk
    Author

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

  7. sam-github commented on Nov 14, 2016

    @sam-github
    Contributor

    See #9483

  8. kilianc commented on Aug 16, 2018

    @kilianc

    Is there a way to do this from env?

  9. naveen1497 commented on Jan 8, 2019

    @naveen1497

    (node:7836) DeprecationWarning:

  10. naveen1497 commented on Jan 8, 2019

    @naveen1497

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions