1、
$ npm install --save-dev babel-cli
2、
$ npm install --save-dev babel-preset-es2015 babel-preset-es2017
3、Create .babelrc in the project root folder with the following contents:
{ "presets": ["es2015","es2017"] }
4、Run your script with babel-node
$ babel-node async.js
原网址:stackoverflow
本文介绍了如何解决在Node.js项目中遇到的不支持async和await关键字的问题。通过在项目根目录创建文件并运行特定脚本来启用这些特性。
678

被折叠的 条评论
为什么被折叠?



