我正在尝试开始我的第一个 ionic 应用程序;在每个 ionic 命令上获取“语法错误:意外标记 [”。从字面上看,所有 ionic 命令都返回相同的输出。
$ ionic start test --v2
/Users/user/.nvm/versions/node/v4.1.1/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:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/user/.nvm/versions/node/v4.1.1/lib/node_modules/ionic/bin/ionic:8:11)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
净 Assets 管理:4.5.0
操作系统:OSX Sierra
最佳答案
解决方案不是按照先前接受的答案的建议进行降级,而是升级节点 as suggested in this answer .
Ionic 需要在 Node > 6 上运行。
所以我正在解决它使用 Brew 在我的 Mac 上升级 Node 的问题,例如:
brew upgrade node
brew link --overwrite node
第一个是升级节点。需要第二个来覆盖我拥有的其他 Node 二进制文件。
使用 Node 7 我能够执行 ionic 命令。
关于ionic-framework - 语法错误 : Unexpected token [ - ionic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43948173/