从 Ionic 3 更新到 Ionic 2,现在由于"Unexpected token {"错误而无法构建



在完成了Ionic博客中定义的升级步骤(此处详细介绍)后,我不会因为某个地方出现了一条关于无效语法的非常不详细的错误消息而无法构建我的Ionic项目。以下是完整的错误:

[14:16:31]  ionic-app-script task: "build" 
[14:16:31]  SyntaxError: Unexpected token { 
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (node_modules@angular-devkitbuild-optimizersrcbuild-optimizerwebpack-loader.js:12:27)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)

我已经尝试使用上面的详细信息对此进行调试,但根本没有取得任何进展。在出现这个错误之前,除了上面详细描述的内容之外,我没有做任何更改(也许我错过了什么?)。有什么想法吗?

package.json

{
"name": "com.myapp.test",
"author": "",
"homepage": "",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"watch": "ionic-app-scripts watch"
},
"dependencies": {
"@angular/common": "4.4.3",
"@angular/compiler": "4.4.3",
"@angular/compiler-cli": "4.4.3",
"@angular/core": "4.4.3",
"@angular/forms": "4.4.3",
"@angular/http": "4.4.3",
"@angular/platform-browser": "4.4.3",
"@angular/platform-browser-dynamic": "4.4.3",
"@ionic-native/core": "4.3.1",
"@ionic-native/splash-screen": "4.3.1",
"@ionic-native/status-bar": "4.3.1",
"@ionic/storage": "2.0.1",
"font-awesome": "4.7.0",
"ionic-angular": "3.7.1",
"ionicons": "3.0.0",
"node-sass": "^4.5.3",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.0.0",
"typescript": "2.3.4"
},
"description": "",
"cordovaPlugins": [],
"cordovaPlatforms": [],
"-vs-binding": {
"BeforeBuild": [
"ionic:build"
]
},
"config": {
"ionic_copy": "./config/copy.config.js",
"ionic_sass": "./config/sass.config.js"
}
}

ionic info的输出

cli packages: (C:UsersmeAppDataRoamingnpmnode_modules)
@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0
local packages:
@ionic/app-scripts : 3.0.0
Ionic Framework    : ionic-angular 3.7.1
System:
Node : v6.10.3
npm  : 4.6.1
OS   : Windows 10
Misc:
backend : pro

根据您的Ionic info,您没有Android SDK Tools。所以你需要安装它。

我正在使用Android SDK Tools : 25.2.5

您还需要安装cordova

这是我的详细信息:

全局包:

cordova (Cordova CLI) : 7.0.1

本地包:

Cordova Platforms  : android 6.2.3

查看如何设置Ionic 3环境

相关内容

  • 没有找到相关文章

最新更新