Skip to main content
Participant
October 17, 2017
Question

Run gulp from Air Application

  • October 17, 2017
  • 2 replies
  • 421 views

I am trying to run a gulp task from my air application on mac using NativeProcess class. It works like charm when compiling and running from intellij but not when compiling a dmg with extendedDesktop profile. It seems to be the problem that air cannot find gulp, at least this is the response (command not found).

When trying to get down to the problem i found out, that air doesnt recognize the /usr folder where gulp is installed (even when installed global via "sudo npm install gulp-cli -g". It's not possibly to locate gulp installation.

Again: common commands like "zip" or something already work with the compiled dmg file. it's just i can't make gulp to be found by the compiled app. same code run by intellij working.

Anyone any idea?

Thank you!

This topic has been closed for replies.

2 replies

Inspiring
October 17, 2017

You are possibly pointing to a shortcut and not the real app.

Inspiring
October 17, 2017

what is the command-line you use in AIR ?
how did you install node/npm and gulp ? homebrew ? macport ? other?

try to run those commands from AIR native process and see their output

"which gulp"

"command -v 'gulp'"

try also
"printenv"

and look in PATH=...
see if the path where gulp is installed is there

also if some of those commands output to stderr instead of stdout
you will need to redirect stderr to stdout

for example:

java -version
will output to stderr

you would need to do

java -version 2>&1

so the stderr is redirected to stdout

some things to explore

1. "gulp"
if command not found
then use "which gulp" or "command -v gulp"
to find the full path, for ex it could returns "/usr/bin/gulp"

2. then try to call gulp with the fullpath eg. "/usr/bin/gulp"


3. the problem could be node
in gulp/gulp.js at master · gulpjs/gulp · GitHub
you can see "#!/usr/bin/env node"

maybe gulp can not find "node" with the "env" command

4. the problem could be your $PATH

if gulp is installed in a local directory like "/opt/local/bin"
maybe this path is not in the PATH environnement variable
and then even if gulp is installed it would not be found


If all that still does not work you could explore the idea
of converting gulp to an executable with such tools
as nexe, node-compile, node-compiler, etc.

and then distribute the exe within the AIR app