构建时出现 Nativescript 错误

Nativescript error on build

我在 ubuntu 服务器上 运行ning nativescript,当我 运行 tns build android.

时遇到问题

/home/nativescript/sample-Groceries/platforms/android/build-tools/check-v8-dependants.js:3 let args = process.argv; ^^^ SyntaxError: Unexpected strict mode reserved word at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3

我安装了这些版本: npm 1.3.10 节点 v0.10.25

我知道 "let" 关键字是 ES6 的一部分,但我该如何解决这个问题? 谢谢!

您需要升级节点版本。获得体面的 ES6 支持;你真的想要最少的 Node 4.x 和和谐标志。从技术上讲,如果你使用和谐标志,那么早期版本的 Node 可以使用 "let" 命令。但是v4之前的支持不是很好

不需要使用和谐旗帜就可以得到很好的支持;当前的 LTS (6.9.x) 对 ES6 功能有很好的支持。

一件事这个错误表示文件中没有 "use strict";;因此,除非您想手动更改该文件,否则您可能只想使用当前的 LTS Node 6.9.x(或更高版本);因为它不再需要 "use strict"; 来使用 ES6 功能。