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

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

1、
[html]  view plain  copy
 
  1. $ npm install --save-dev babel-cli  


2、

[html]  view plain  copy
 
  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

你可能感兴趣的:(「Node.js」)