我是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
发生了什么事? 退出代码。
答案 0 :(得分:15)
更新到最新的节点版本(v12.6 +)会删除警告。
答案 1 :(得分:9)
我当时使用的是旧版本node@^10.15.1
,所以我将其更新为12.16.1
或12.16.2
并得到修复。
答案 2 :(得分:7)
是的,您可以放心地忽略此警告。
如果要禁止显示它(以及所有警告),请使用node --no-warnings
而不是node
运行脚本。
在您的示例中:
node --no-warnings `which autorest`
答案 3 :(得分:5)
我在node@10.16.1
,我将其更新为12.18.2
,它已经修复!
答案 4 :(得分:2)
模块autorest
使用新的fs
语法,而不是回调使用Promises。然而,这还不稳定,因此是警告。除非你想在生产中使用它,否则没什么好担心的。但即便如此,只要你用节点一起更新autorest就不会出现问题。
至于错误,它可能是你的配置中的东西。尝试制作最小错误样本并将问题发布到autorest git。
答案 5 :(得分:2)
在Angular 10
中,这只是提供代码时的警告,您可以从今天开始忽略它。
答案 6 :(得分:-1)
可能是因为您更新了 npm 版本而不是 node 版本。 我将 npm 版本从 6.3.0 更新到 7.16.0 [目前最新],但节点仍然使用 11.3.0。为了修复这个版本,我将节点更新到最新的 LTS,即 14.17.0 [LTS at this time]。
nvm install 14.17.0 // Check for the LTS
nvm use 14.17.0
nvm alias default 14.17.0