V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
liuhd
V2EX  ›  Node.js

在命令行中执行 node 脚本,使用--trace-deprecation 选项却没有打印出 trace

  •  
  •   liuhd · 2017-10-11 15:15:27 +08:00 · 4314 次点击
    这是一个创建于 2382 天前的主题,其中的信息可能已经有所发展或是发生改变。

    var Util = require('util');

    Util.print('fdfasd');

    上面两行是我的代码,我在命令行下执行的命令是 node index.js --trace-deprecation

    控制台打印结果: fdfasd(node:17893) DeprecationWarning: util.print is deprecated. Use console.log instead.

    没有 trace !!! 我感觉我肯定是哪里理解有错误,但是翻了文档,查了 google,还是没结果,所以,我就是想问,为什么 trace 选项没效果呢,Util.print 是已经被废弃了,运行时会报错的。这一点我确定。

    liuhd
        1
    liuhd  
    OP
       2017-10-11 23:50:01 +08:00
    已经解决了,是我把 option 的位置放错了,应该放在 node 之后,脚本名称之前,放在脚本名称之后是脚本执行被传入的参数。唉,怎么就为了这么个错误耽误了这么长时间
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2613 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:47 · PVG 09:47 · LAX 18:47 · JFK 21:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.