解决nodejs不支持async和await关键字的问题

来源:互联网 发布:网络程蝶依视频 编辑:程序博客网 时间:2024/05/16 17:23

http://blog.csdn.net/brave_coder/article/details/69802881

1、
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. $ npm install --save-dev babel-cli  


2、

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. $ 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

原创粉丝点击