代码之家  ›  专栏  ›  技术社区  ›  Kirsten

实验警告:fs.promises API是实验性的

  •  3
  • Kirsten  · 技术社区  · 7 年前

    我对node和npm不太熟悉,并且尝试理解autorest。

    当我打字时

    autorest --list-available
    

    进入PowerShell ISE 我得到

    AutoRest code generation utility [version: 2.0.4262; node: v10.1.0]
    (C) 2018 Microsoft Corporation.
    https://aka.ms/autorest
    autorest : (node:12580) ExperimentalWarning: The fs.promises API is experimental
    At line:1 char:1
    + autorest --list-available
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: ((node:12580) Ex...is experimental:String) [], RemoteExc 
       eption
        + FullyQualifiedErrorId : NativeCommandError
    
     Extension Name                 Version       
    
     @microsoft.azure/autorest-core 2.0.4278       
     @microsoft.azure/autorest-core 2.0.4277       
     @microsoft.azure/autorest-core 2.0.4276       
     @microsoft.azure/autorest-core 2.0.4275       
     @microsoft.azure/autorest-core 2.0.4274       
     @microsoft.azure/autorest-core 2.0.4272       
     @microsoft.azure/autorest-core 2.0.4271       
     @microsoft.azure/autorest-core 2.0.4269       
     @microsoft.azure/autorest-core 2.0.4263       
     @microsoft.azure/autorest-core 2.0.4262       
    Failure:
    TypeError: volume[member].bind is not a function
    TypeError: volume[member].bind is not a function
        at patchFilesystem 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:277:43)
        at C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:281:18
        at Object.global.staticloader.undo 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:163:7)
        at process.exit.n [as exit] 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:170:27)
        at main (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\app.js:153:21)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    (node:12580) UnhandledPromiseRejectionWarning: Error: EBADF: bad file descriptor, close
        at Object.fs.closeSync (fs.js:529:3)
        at StaticVolumeFile.shutdown 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:352:10)
        at StaticFilesystem.shutdown 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:406:17)
        at process.exit.n [as exit] 
    (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:169:11)
        at main (C:\Users\kirst\AppData\Roaming\npm\node_modules\autorest\dist\app.js:239:17)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    (node:12580) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated 
    either by throwing inside of an async function without a catch block, or by rejecting a promise 
    which was not handled with .catch(). (rejection id: 1)
    (node:12580) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the 
    future, promise rejections that are not handled will terminate the Node.js process with a non-zero 
    

    发生什么事了? 退出代码。

    2 回复  |  直到 7 年前
        1
  •  2
  •   Akxe    7 年前

    模块 autorest 使用新的 fs 语法上,它不是回调而是使用承诺。然而,这还不稳定,因此是一个警告。没什么好担心的,除非你想在生产中使用它。但即使这样,只要一起更新autorest和节点,就不会出现任何问题。

    至于这个错误,它可能是您的配置中的一些内容。尝试进行最小的错误样本并将问题发布到autorest git。

        2
  •  8
  •   Ore4444    6 年前

    是的,您可以安全地忽略此警告。 如果要禁止显示它(以及所有警告),请使用 node --no-warnings 而不是 node .

    在您的示例中:

    node --no-warnings `which autorest`
    
    推荐文章