问题
Titanium SDK will not recognize Titanium CLI, node, alloy, or npm on Ubuntu 12.04
I followed the installation instructions for the Titanium SDK here: http://docs.appcelerator.com/titanium/latest/#!/guide/Quick_Start
Each time I try to launch titanium, it prompts me for some Titanium Updates.
But of course, when I click the fancy update button, it tells me:
'Installing Titanium Updates...' has encountered a problem. Error encountered during update.
Cannot install Node on platforms other than Windows or Mac.
NPM is not installed.
NPM is not installed.
NPM is not installed.
I disagree: I have definitely installed node, npm, and I manually installed alloy with
npm install -g alloy
Here are some other relevant results from my terminal:
ryan@Grisbuntu:~$ which node
/home/ryan/local/bin/node
ryan@Grisbuntu:~$ which titanium
/home/ryan/local/bin/titanium
ryan@Grisbuntu:~/local/bin$ titanium -v
3.1.2
ryan@Grisbuntu:~/local/bin$ node -v
v0.10.15
ryan@Grisbuntu:~/local/bin$ alloy -v
1.2.2
ryan@Grisbuntu:~/local/bin$ npm -v
1.3.5
I'd like to continue with a "Hello World" application (and beyond), but for example when I click "Run->Android Emulator", I get the following error:
'Launching Titanium Android Emulator - html5-hello' has encountered a problem.
Unable to locate the CLI executable. Please restart Studio or use Help > Check for Titanium Updates to install Titanium CLI.
I have discovered quite a few similar questions out there, but few answers... can anyone give me a clue as to how to fix this? I am new to Titanium/Eclipse: Is there a simple path setting that I am missing somewhere?
回答1:
I think I fixed my own problem. Despite the fact that node and npm were previously installed on my system, and I was able to do things like "node -v" and "titanium -v" from a "normal" linux terminal, Titanium was not recognizing the existence of any of these programs. I tried various combinations of inserting an export statement into my bash profile, uninstalling and reinstalling node, (via apt-get and manually extracting the tarball, etc) and so on, but nothing seemed to work.
What I ended up doing was launching my Titanium project, and I ran "node -v". It gave me version 0.6.blah.blah. I am still confused why this is... but to solve it, using the terminal WITHIN titanium, I issued all the following commands:
(before I go on, if you're going to try this yourself, this answer might be incomplete or slightly inaccurate: i'm sorry that I didn't write it down exactly as i went... but this is close. The point to this solution is that I had to do it FROM WITHIN titanium).
sudo apt-get remove npm
sudo apt-get remove node
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure && make && sudo make install
RESTART TITANIUM then, again in a titanium terminal, run
npm install titanium
npm install alloy
Those last 2 commands are what really got me over the hump. My hello world application, and my android emulator, now successfully launch. Hope that helps someone. If anyone can explain to me why I had to do it this way, I'd like to understand it. Otherwise, thanks & good luck!
来源:https://stackoverflow.com/questions/18965858/titanium-sdk-will-not-recognize-titanium-cli-node-alloy-or-npm-on-ubuntu-12-0