【原创】报错分析 Block-scoped declarations (let, const, function, class) not yet sup ported outside

个人项目中使用node做后端,vue开发前端,本来个人电脑上和云服务器上跑一直都没问题,当从另一台电脑从git上把项目拉下来后,发现无法运行,报各种错误。刚开始以为是node_modules缺失文件,后从云服务器上拷贝node_modules出来,还是报错,报错内容如下

node项目中报:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet sup ported outside
前端项目中报:

 asset optimization ERROR  Failed to compile with 8 errors18:11:41

 error  in ./src/App.vue

Syntax Error: Unexpected token {


 @ ./src/main.js 5:0-24
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server                                                                                                                                   ./src/main.js

 error  in ./src/components/index.vue

经过分析发现,是本地node版本太低了只有4.0+,将本地node用nvm切换至8.0+即可正常运行

你可能感兴趣的:(前端学习总结,工作笔记)