Deploy-hooks. How to run command on server

I’ve installed acf-field-openstreetmaps plugin with Composer:

This plugin needs to run npm install && gulp inside its root directory, so, I’m trying to add this task to deploy-hooks;

- name: Compile assets of ACF Open Street Maps plugin
  command: npm install && gulp
  args:
    chdir: "{{ project.local_path }}/web/app/mu-plugins/acf-field-openstreetmap"

It returns an error:

No such file or directory: '/home/musicasusual/web/app/mu-
plugins/acf-field-openstreetmap'

The acf-field-openstreetmap directoy is in the server inside mu-plugins (checked). So, which is the right way to run the npm install && gulp command from plugin directory on server side?

Thank you!

EDIT: tried too with {{ deploy_helper.current_path }}

1 Like

Which hook are you using?

You likely need to use deploy_helper.new_release_path. current_path probably isn’t set at that point yet.

1 Like

It looks like you’d want to use a production version of that plugin and not the development one (that requires building) to deploy it. You could use their ZIP file from GitHub with Composer.

1 Like

@swalkinshaw deploy_helper.new_release_path works fine in a build-after hook, after Install Composer dependencies. Thank you for the answer!

@ben definitely, installing zip version solve the plugin installation. I was thinking that zip file was an abandoned zip because it lacks of gulpfile inside, but it is just the dist version :sweat_smile: Thank you for point me in the right direction.

2 Likes

This topic was automatically closed after 42 days. New replies are no longer allowed.