Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G gulp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gulp
  • gulp
  • Issues
  • #2033
Closed
Open
Issue created Oct 25, 2017 by Administrator@rootContributor

'/usr/bin/env: node: No such file or directory' error when running `gulp` via cron job

Created by: romellem

This is mostly to add some documentation since I am unable to comment on #436 (closed).

Basically, if you have a gulp task, say build, that you normally run via

gulp build

And you are trying to add that to a cron job, you may try something like this: while ssh'd, you run

which gulp

To get a full path for the global gulp. I get back the path /usr/local/bin/gulp (yours might differ).

Anyways, once you have this path, you might decide "run this gulp task every five minutes," which would be setup as the following cron job:

*/5 * * * * cd /your/dir/to/run/in && /usr/local/bin/gulp build

However, you will see in the cron logs that you get this error:

/usr/bin/env: node: No such file or directory

#436 directs you to try the following:

I also did face same issue. This is how I solved it. sudo ln -s /usr/bin/nodejs /usr/bin/node

just in case someone came here looking for solution to this problem.

However, that assumes that /usr/bin/nodejs is the actual path to your node binary.

Really what you want to do is run which node, and whatever that path is, is what you want to link to.

In my case, running which node shows:

/usr/local/bin/node

So, first I ended up running

sudo ln -s /usr/local/bin/node /usr/bin/node

And only after creating that symbolic link did my original cron job execute.


TL;DR:

Run the following if you are having trouble running a gulp task from cron:

sudo ln -s $(which node) /usr/bin/node
Assignee
Assign to
Time tracking