如何使 Titanium (SDK) 工作?

How to make Titanium (SDK) work?

在使用 Yosemite 的 MacBook 上更新到 Titanium SDK 3.5.0 后,我所有的开发人员机器上都出现了几个问题,这使我无法处理当前的项目:

问题

  1. "ti info" 由于 longjohn.js 中的异常而停止(见下面的附件)

  2. "ti setup" 在生成 childProcess

  3. 时因另一个异常而停止
  4. Titanium Studio 找不到我的 iOS SDK,尽管至少安装了 iOS SDK 8.1 并且在 XCode 中运行良好(下面提供了更多信息)

  5. 每次启动 Titanium Studio 后都会出现一个错误对话框,说明 "An internal error occured during Computing SDK Info, java.lang.NullPointerException",这似乎与我上面提到的 #3 下的问题有关。

  6. 由于上述几点,无法使用钛构建任何 iOS 应用程序

安装的版本:

错误信息

1. "ti info":(在终端)

Titanium Command-Line Interface, CLI version 3.4.1, Titanium SDK version 3.5.0.GA
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.

Please report bugs to http://jira.appcelerator.org/

 |[ERROR] Failed to run command "info"
/usr/local/lib/node_modules/titanium/node_modules/longjohn/dist/longjohn.js:185
        throw e;
              ^
logger.log (/usr/local/lib/node_modules/titanium/lib/logger.js:72:21),target.(anonymous function) [as error] (/usr/local/lib/node_modules/titanium/node_modules/winston/lib/winston/common.js:45:21),CLI.<anonymous> (/usr/local/lib/node_modules/titanium/lib/cli.js:955:17),/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:119:25,Object.<anonymous> (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:24:16),CLI._fireHookCallback (/usr/local/lib/node_modules/titanium/lib/hook.js:269:12),/usr/local/lib/node_modules/titanium/lib/hook.js:248:10,/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:232:13,async.eachSeries (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:130:20)
ha

2。 "ti setup"(终端)

> Where do you want to go? 1

 |[ERROR] TypeError: Incorrect value of args option

    at normalizeSpawnArguments (child_process.js:952:11)
    at exports.spawn (child_process.js:984:38)
    at run (/Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/node-appc/lib/subprocess.js:47:14)
    at Object.detect (/Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/node-appc/lib/jdk.js:71:3)
    at async.parallel.jdk (/Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/titanium-sdk/lib/android.js:71:13)
    at /Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/async/lib/async.js:524:25
    at /Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/async/lib/async.js:111:13
    at Array.forEach (native)
    at _each (/Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/async/lib/async.js:32:24)
    at async.each (/Users/<user>/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA/node_modules/async/lib/async.js:110:9)

3。 Titanium Studio 找不到任何 iOS SDK:

我已经执行了: $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

然后我输入"Titanium Studio -> Preferences -> Studio -> Platforms -> iOS"。 iOS SDK Home 的设置为空并显示 "Not specified"。

但是 iOS 8.1 的 SDK 已经安装:

Titanium Studio 日志文件中的一些重要消息:

!MESSAGE An internal error occurred during: "Computing SDK Info...".
!STACK 0
java.lang.NullPointerException
    at com.appcelerator.titanium.ui.portal.processor.MobileSDKConfigurationHelper.getVersionInfo(MobileSDKConfigurationHelper.java:133)
    at com.appcelerator.titanium.ui.portal.processor.MobileSDKConfigurationProcessor.computeStatus(MobileSDKConfigurationProcessor.java:74)
    at com.aptana.configurations.processor.AbstractConfigurationProcessor.getStatus(AbstractConfigurationProcessor.java:154)
    at com.appcelerator.titanium.ui.portal.actionController.MobileSDKActionController.run(MobileSDKActionController.java:127)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


!MESSAGE An internal error occurred during: "Sending Analytics Ping ...".
!STACK 0
java.lang.NullPointerException
    at com.aptana.usage.internal.DefaultAnalyticsEventHandler.getAnalyticsLogger(DefaultAnalyticsEventHandler.java:207)
    at com.aptana.usage.internal.DefaultAnalyticsEventHandler.sendEventSync(DefaultAnalyticsEventHandler.java:241)
    at com.aptana.usage.internal.DefaultAnalyticsEventHandler.run(DefaultAnalyticsEventHandler.java:75)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)



!ENTRY com.aptana.core 4 1 2015-02-20 11:37:18.555
!MESSAGE sudo: a password is required

!ENTRY com.appcelerator.titanium.core 4 0 2015-02-20 11:38:17.801
!MESSAGE (Build 3.4.1.201410281727) [ERROR]  Unable to locate the CLI executable. Please restart Studio or use Help > Check for Titanium Updates to install Titanium CLI.

(有趣的副作用:在 appcelerators 开发者论坛中提出这样的问题将立即被拒绝并显示消息 "This data was not accepted because it was flagged as spam."(我尝试了多种变体))

我能知道什么?

有趣的事实:Appcelerator Titanium 不支持 Node 0.12。

为了一步解决所有这些问题,我只需要从 Node 0.12 切换回 Node 0.10.35。

使用旧版本的 Node (10.33) 为我解决了这个问题。

我使用节点包管理器安装 "n",它允许您切换版本(您需要 运行 它作为 sudo):

npm install -g n

然后切换版本,同样sudo:

n 0.10.33

(OS Yosemite) 如果其他人遇到此问题,请检查对以下文件夹的权限:

/Users/user.folder/Library/Application Support/Titanium/mobilesdk/osx/

确保对所有子文件夹/文件应用权限。我的机器上有一个权限问题,在重新安装 titanium 2 次后,将节点降级到各种不同的版本,并按照各种堆栈溢出线程中的所有说明进行操作。