V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
liuhd
V2EX  ›  Node.js

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

  •  
  •   liuhd · Oct 11, 2017 · 5041 views
    This topic created in 3134 days ago, the information mentioned may be changed or developed.

    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
       Oct 11, 2017
    已经解决了,是我把 option 的位置放错了,应该放在 node 之后,脚本名称之前,放在脚本名称之后是脚本执行被传入的参数。唉,怎么就为了这么个错误耽误了这么长时间
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3412 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 11:58 · PVG 19:58 · LAX 04:58 · JFK 07:58
    ♥ Do have faith in what you're doing.