Using translate:pot results in /bin/sh: wp: command not found

Hello,
I’m using a Sage with Bedrock / Wordpress in a DDEV container.

Now I tried to use the default script translate:pot in the Sage theme folder to create language files.
But i get the following output

$ yarn translate:pot
yarn run v1.22.19
$ wp i18n make-pot . ./resources/lang/sage.pot --include="app,resources"
/bin/sh: wp: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried several things like adding ddev in front of the translate:pot’s commands, but nothing is working.

Do I miss a config setting or how can I use these commands?
WP-CLI is working when adding ddev before the command.
I can call

 ddev wp db export sample.sql

to export the current database.

But same scheme does not work with

"translate:pot": "ddev wp i18n make-pot . ./resources/lang/sage.pot --include=\"app,resources\"",

Can you manually invoke ddev wp i18n, what sub-commands does it list (in its help text)?
What version does ddev wp cli version report?

1 Like

I don’t know how ddev wp works, but the quickest way to get up and running would be to just install WP-CLI on your host machine

Are you executing yarn translate:pot from within the Ddev-container? If not, I would give that a go by running ddev ssh from the root of the project and then navigate to the theme from there.

It may be that you need to run yarn when in the Ddev machine as well before you try Yarn commands. But I may be wrong, the Yarn/NPM modules stuff is a black hole of magic to me.

FWIW, I always run my commands for assets-building, deploys etc. from within my Ddev-machines and have no issues with running wp-commands in the Sage-folder.

1 Like