【问题标题】:Install/test problem with full Nativescript CLI install完整 Nativescript CLI 安装的安装/测试问题
【发布时间】:2019-05-28 06:41:00
【问题描述】:

我已经在 MacOS X 上完成了 Nativescript CLI 的明显干净安装,但是当我运行 tns doctor 时它失败了:

bash-3.2$ /usr/local/lib/node_modules/nativescript/bin/tns doctor

/usr/local/lib/node_modules/nativescript/lib/common/verify-node-    version.js:32
            console.warn((`${os.EOL}${nodeWarning.message}${os.EOL}`).yellow.bold)
                  ^
SyntaxError: Unexpected token ILLEGAL
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous>     (/usr/local/lib/node_modules/nativescript/bin/tns:8:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

【问题讨论】:

  • 您使用的 Node.js 版本似乎不受支持。 node --version 的输出是什么?
  • bash-3.2$ 节点 --version v0.10.29

标签: installation command-line-interface nativescript tns


【解决方案1】:

问题是您使用的是非常旧的 Node.js 版本。 NativeScript CLI 至少需要 Node.js 6,但我建议您使用当前的 LTS - Node.js 10。 Node.js 0.10.29(这是您当前的版本)不支持 NativeScript CLI 代码库中使用的语法。

【讨论】:

  • 你是对的,只是最新的 CLI (5.x) 至少需要 Node 8。
  • 谢谢 - macOS X Mojave 上的节点更新/升级过程给了我 v0.10.29;安装 Node8 让我更进一步。现在的问题是:bash-3.2$ sudo tns doctor 密码:******** module.js:550 throw err; ^ 错误:找不到模块 'semver' ...
  • 我认为这是一个路径问题,但是将一个指向模块目录的链接全部移动似乎并不能解决问题。
【解决方案2】:

前一个问题是由于 node,js 版本过时;安装节点 10 (LTS) 解决了它。

后一个问题是由于一个扭动的 python 巢造成的——命令“python”链接到 python 2.5,而安装脚本调用了 python 2.7 及其附带的用户插件。将“python”重新链接到 python 2.7 可执行文件解决了这个问题。

【讨论】:

    猜你喜欢
    • 2016-10-27
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 2020-05-25
    相关资源
    最近更新 更多