Node.js is required for several Appcelerator components, including the Axway Appcelerator CLI, Alloy, and the API Builder. Node is also required to build the Titanium SDK from source starting with Release 3.0.
Compatibility and Download
To run all Appcelerator components, you must have Node.js 8.0.0 or later.
On Mac OS X and Windows, if you have selected to install Titanium updates, Studio prompts you to install Node.js. On Linux, you need to manually install Node.js.
Before installing the CLI, you should decide where you want the Node Package Manager (
npm) to install packages. By default
npm installs into
/usr/local on OS X and Linux, which requires that you run
npm as root. This is not recommended. You can avoid having to run
npm by doing one of the following:
/usr/localdirectory writable by all:
npmto install to your home directory, or another directory of your choosing by setting the
npmprefix. For example, you can add the following to your
.bash_profileor other initialization file:
Alternately, you can create a .npmrc file in your home directory with the following contents:
Where /path/to/home is the path to your home directory. Setting the
npmprefix to your home directory causes the
npmpackages to be installed to
$HOME/lib/node_modulesand launch scripts are installed in
$HOME/binmust be in your PATH.
If you change your prefix after installing
npm packages, you will have to reinstall packages. If you change the permissions on
/usr/local after installing packages as root, you may need to change the ownership of the
npm cache folder, as described in Troubleshooting npm Problems.
Using NPM packages in Titanium
npm initin the
app/libfolder in your Alloy project. If you are using a classic app, run the init step in your
- Follow the steps npm gives you when doing the init step. Note: You don’t have to fill out anything if you don't need to.
npm i <packagename>in the
/libfolder to install a package. For example, let’s set up to.imagecache. You'd use this comment to install the package:
npm i to.imagecache
- Add the
lib/node_modulesfolder and the
package-lock.jsonfile to your
- On any other machine you want to set this up, go to your
npm installand all packages will be installed to your app.
Usage of packages
Usage of a package is like another module or library file. Using the
To install a package dependency,
- Ensure you are in the
/libfolder, or if using a classic project, the
npm i <dependency>
To use the dependency, for example a module called
to.cacheimageview(sample extension of the
To find all the current packages with the
titanium-module, you can use this npm site search: https://www.npmjs.com/search?q=keywords:titanium-module
A lot of Titanium packages are found using the titanium or titanium-module keywords. Note: when creating a public common.js module and/or library file, please tag it with the
Error: EONT, stat `C:\Users\<USER_NAME>\AppData\Roaming\npm`
The error message indicates the folder is missing. To resolve this issue, manually create the folder:
Issues Installing NPM packages
If you experience an issue installing any of the
npm packages, try the following:
Check permissions. If you originally ran
sudo, you may need to change the ownership of the
On Windows, the npm cache defaults to
npm-cachein the user's home folder.
- Remove your