ionic-framework - 安装后 ionic 问题

标签 ionic-framework syntax-error

我需要一些帮助来解决 Mac 上的 ionic 问题。对于我从带有 ionic 的终端启动的每个命令,我都会收到如下所示的相同错误。

例如,即使我发出命令 ionic -v ,我收到这个:

$ ionic -v
/usr/local/lib/node_modules/ionic/dist/index.js:24
        const [xcode, iosDeploy, iosSim,] = yield Promise.all([
              ^

SyntaxError: Unexpected token [
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/bin/ionic:8:11)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

我检查了文件 /usr/local/lib/node_modules/ionic/dist/index.js ,但一切都很好。即使有这个解析错误,我什至尝试卸载并重新安装 ionic 但没有成功。有人可以给我建议吗?

最佳答案

我已经解决了这个问题!我的nodejs版本太旧了(5.6.0),我看到它不适用于ionic cli,所以我在nvm之前安装了

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

然后从终端启动 -> nvm install v6.10.3 以获得最后一个稳定的 node js 版本,现在一切又正常了!

关于ionic-framework - 安装后 ionic 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43879265/

相关文章:

sql - 动态SQL语法错误SQLScript SAP HANA

python - Long Int 文字 - 语法无效?

javascript - script.js 第一行为 :1 Uncaught SyntaxError: Unexpected token . - Node.ELEMENT_NODE

ios - Ionic - 构建 IOS 版本的应用程序时出错

angularjs - 如何将 ngCordova s​​qlite 服务和 Cordova-SQLitePlugin 与 Ionic Framework 一起使用?

angular - Ionic 2 安排服务

python - 第 1 行的 SyntaxError : Non-UTF-8 code starting with '\x90' in file C:\Python36\python. exe,但未声明编码

python - sqlite3.OperationalError : near “)” : syntax error in tkinter Python

javascript - angularjs搜索过滤器问题

angular - 为什么 LoadingController 在 API 调用期间尝试关闭它时抛出 'Overlay does not exist '