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

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

你可能感兴趣的:(nodejs)