首页 > 开发 > NodeJS > 正文

急!ionic上传本地项目到平台(Ionic View)时出错

2017-09-08 17:22:55  来源:网友分享

我要在真机上预览本地项目,手机上下载app ‘Ionic View’,然后要在ionic网站注册一个账号,本地命令行登录后切到项目目录下运行ionic upload命令将项目上传,再在手机的‘Ionic View’上登录就可以真机运行项目了。但是在运行完ionic upload之后报错,错误如下:

Uploading app....An error occurred uploading the build: SyntaxError: Unexpected token <SyntaxError: Unexpected token <    at Object.parse (native)    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/upload.js:300:25)    at emitNone (events.js:72:20)    at IncomingMessage.emit (events.js:166:7)    at endReadableNT (_stream_readable.js:921:12)    at nextTickCallbackWith2Args (node.js:442:9)    at process._tickCallback (node.js:356:17)Unexpected token < (CLI v2.0.0)Your system information:Cordova CLI: 6.3.1Gulp version:  CLI version 3.9.1Gulp local:   Local version 3.9.1Ionic CLI Version: 2.0.0Ionic App Lib Version: 2.0.0ios-deploy version: Not installedios-sim version: 5.0.8 OS: Mac OS X El CapitanNode Version: v4.5.0Xcode version: Xcode 7.3.1 Build version 7D1014 

开发系统:mac 测试设备:ios
想知道这是什么意思,怎么解决,求帮忙。

我的主要目的是在真机上运行我的app,调试或者预览都可以,但是我在打包时也报错了,错误如下:

The following build commands failed:    ProcessPCH /Applications/XAMPP/xamppfiles/htdocs/saxe_app_web/platforms/ios/build/sharedpch/CordovaLib_Prefix-esfsteftyiiwmubuqszgkwrzkyeb/CordovaLib_Prefix.pch.pch CordovaLib_Prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler(1 failure)Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Applications/XAMPP/xamppfiles/htdocs/saxe_app_web/platforms/ios/cordova/build-debug.xcconfig,-project,foodSafety.xcodeproj,ARCHS=i386,-target,foodSafety,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Applications/XAMPP/xamppfiles/htdocs/saxe_app_web/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Applications/XAMPP/xamppfiles/htdocs/saxe_app_web/platforms/ios/build/sharedpch

该怎么办呢,这两个问题能解决一个就好,能在手机上看就行。
大家有没有遇到过这种问题,该怎么解决?

解决方案

最完美的解决方案应该是用xcode打开,手机连上之后直接真机调试,ionic view有点问题,和真机还是有点差距的,比如有些cordova的插件在那里面就用不了

ionic build ios

然后用xcode打开生成的 /platforms/ios/你的项目名.xcodeProj 文件,然后之后就是登陆你的appleId,然后fixIssue,再在左那里选择你的手机,然后点那个三角形就可以了。

具体的步骤要你自己上网查了~