How I wish Titanium Mobile to be better: Problem upgrading Titanium CLI to 3.2.0

I think I have found the possible root cause. Comment first; I know many of Titanium developers are from the Web world, and are not very familiar with full-blown software development environment outside WebKit. That’s why I find many questions and answers in this forum to be a little of low quality. This is not to offend anyone, I understand because I were like you before, a Web developer, until I got a proper degree in Computer Engineer almost 7 years ago.

It’s also something staffs at Appcelerator will have to tolerate with. But actually having a helpful and intelligible user community is one of the success factors of a framework. After using Titanium Mobile for a while, I find that the documentation can be much much better in help educating the community (Though currently it is already considered good). Look at Symfony Web framework, it has successfully bring former monkey PHP coder like me to learn best coding practices and leverage the development skill to the next level. I wish to see that in Titanium Mobile as well. By having more organized and comprehensive documentation rather than a few simple tutorials just to get amateur developer in, the community will grow to become strong and knowledgable and finally benefits the ecosystem in return.

To give an idea, the documents could possibly targeting at Web developer who knows very little about software development tools/workflow/practices, to have a smooth transition from the Web world and at the same time learn about how to properly develop software ( explanation of npm’s basic is a good example).

One more thing before I explain how to update CLI to titanium 3.2.0 (I was getting stuck at 3.1.2 too), I tried searching for iOS QR Code reader module in Google and found many links to this forum where almost all replies are pointing to outdated module from someone, and nothing about Ti’s official QR Code module until I try searching in modules’ market at last resort. The module is even underrated even though it’s working ( I know there are some mis-resolving but with some workaround this is ok). I think Ti need someone to oversee these matters, you guys built great platform but have no awesome way to represent it!

Ok, enough for comment for my beloved Titanium. Here is the solution I found:

For those of you who don’t want the details do this: ( Mac OS X or Linux, I don’t know Windows command)

  1. In command line, run ‘npm bin -g’ (of course without ‘ ).
  2. You should see current configuration setting for bin directory; make note of the return value, it is the path where npm program is being installed to.In my system this is /Applications/Titanium Studio/
    Obviously, Titanium installation has changed my default npm installation prefix! And it is not in my PATH environment variable so the newly installed titanium package will never get called, but the old module which is still installed some where in the system is still intact! 

    I don’t know how this Titanium setting has creeped in, but the setting is derived from ‘/usr/local/etc/npmrc’ file.

    In your case this may be different, just follow on.

  3. Type ‘which titanium’ and note the path returned; that is the path of current titanium version you are using.
  4. If the path’s value from 2) and 3) doesn’t seem to match ( e.g. 2) = /usr/local/bin 3) = /some/other/dir ) I means you have two install location, which must be the case if after installing new version of titanium CLI but you still calling the old one.
  5. Run ‘sudo npm config set prefix /usr/local’ which will revert back the npm prefix for bin and lib/node_module (global package install location) to the default.
  6. Now install titanium again using ‘sudo npm install titanium -g’
  7. This is optionally but you may want to delete whatever in and over path from 2) and related stuffs. It’s old npm’s installation after we have changed prefix in step 5)

Hope this helps.


Enhanced by Zemanta