【发布时间】:2018-02-22 21:19:22
【问题描述】:
一位朋友建议我从 javascript 切换到 Typescript,以解决我在循环和条件中实现 Promise 时遇到的问题(TS 具有 async/await 功能)。我似乎永远无法正确编译 TS。我在 VSCODE 终端上遇到的最新错误(与我在控制台上遇到的错误集不同)是:
error TS6053: File 'c:/stuff/node_modules/@types/node/index.d.ts' not found.
所以我创建了那个目录结构并将 index.d.ts 放在那里,现在我得到了这些错误:
node_modules/@types/node/index.d.ts(6,25): error TS2307: Cannot find module 'stream'.
node_modules/@types/node/index.d.ts(14,32): error TS2304: Cannot find name 'Buffer'.
node_modules/@types/node/index.d.ts(15,78): error TS2304: Cannot find name 'Buffer'.
node_modules/@types/node/index.d.ts(23,39): error TS2304: Cannot find name 'Buffer'.
【问题讨论】:
-
最新版本的Node有async/await。
-
...是 6.x 吗?
-
nodejs.org 8.5 是最新版本。 Async/Await 到达版本 8。
-
好的。我该如何更新到该版本?我是节点新手
-
我喜欢
n- 它使版本之间的切换变得容易:github.com/tj/n
标签: node.js typescript ecmascript-2017