安装后的离子问题 [英] Ionic issue after installation
问题描述
我需要一些帮助来解决我的mac上的离子问题。对于我从终端使用ionic启动的每个命令,我收到的错误如下所示。
I need some helps to solve problems with ionic on my mac. For every command I launch from terminal with ionic, I receive the same error as shown below.
例如,即使我发出命令 ionic -v
,我也会收到:
For example even if I give command ionic -v
, I receive this:
$ 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
,但一切都很好。即使有这个解析错误,我甚至尝试卸载并重新安装离子而没有成功。有人可以给我建议吗?
I have checked the file /usr/local/lib/node_modules/ionic/dist/index.js
, but all is fine. Even there's this parse error, I even tried with uninstall and reinstalled ionic without success. Can someone give me suggestions please?
推荐答案
我已经解决了这个问题!我的nodejs版本太旧了(5.6.0)并且我已经看到它不适用于离子cli,所以我在nvm之前安装了
I have solved this! My nodejs version was too old (5.6.0) and I have seen that it doesn't work with ionic cli, so I have installed before nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
然后从终端启动 - > nvm install v6.10.3以获得最后一个稳定节点js版本,现在一切都有效了!
and then launch from terminal -> nvm install v6.10.3 to have last stable node js version, now all works again!
这篇关于安装后的离子问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!