构建时出现Nativescript错误

时间:2017-01-07 13:59:55

标签: node.js npm ecmascript-6 nativescript

我在ubuntu服务器上运行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

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

1 个答案:

答案 0 :(得分:3)

您需要升级节点版本。为了体面的ES6支持;你真的希望最小的Node 4.x带有和声标志。从技术上讲,如果你使用和声标志,那么早期版本的Node可以使用" let"命令。但是在v4之前的支持并不是很好。

在不使用和谐旗帜的情况下获得非常好的支持;目前的LTS(6.9.x)对ES6功能有很好的支持。

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

相关问题