Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15804

CLI: All commands fail if "node" executable is not actually called "node"

    Details

      Description

      On Ubuntu, we found that if node.js is installed via some sort of Debian package, that installs node.js as /usr/bin/nodejs. /usr/bin/node is a symlink to /etc/alternatives/node which is also a symlink to /usr/bin/nodejs.

      The problem is process.args[0] is "node", but process.execPath is "/usr/bin/nodejs". The CLI compares these two to detect if the first arg is the node.js executable, then strip it off. Because "node" != "nodejs", the executable is not stripped off and the error happens.

      [ERROR] "/usr/bin/titanium" is an unrecognized command.
      

      or

      [ERROR] "/usr/local/bin/titanium" is an unrecognized command.
      

      To fix this, we need to properly resolve process.args[0]. That means that the CLI needs to call appc.subprocess.findExecutable(process.argv[0], ...) to convert "node" to "/usr/bin/node", then we need to run fs.realpathSync() on that result to resolve the symlinks to "/usr/bin/nodejs" and finally compare that to process.execPath.

      Workaround

      As a temporary workaround, you can copy /usr/bin/nodejs to /usr/bin/node.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cbarber Chris Barber
                Reporter:
                cbarber Chris Barber
                Reviewer:
                Allen Yeung
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17893
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code