Development docker - version13 - Yarn not found

Dears,
I’m trying to follow this tutorial (https://github.com/frappe/frappe_docker/tree/develop/development) in order to install a development frappe environment. I don’t work with VSCode Remote Containers, I attach directly to my container with:

docker exec -ti <my-frappe-container> bash

I get the following error at the step " Setup first bench":

frappe@19d88d7cb6a1:~$ bench init --skip-redis-config-generation --frappe-branch version-13 frappe-be
nch
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

$ /usr/bin/virtualenv -q env -p python3
Already using interpreter /usr/bin/python3

Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 3129, done.
remote: Counting objects: 100% (3129/3129), done.
remote: Compressing objects: 100% (2929/2929), done.
remote: Total 3129 (delta 421), reused 1117 (delta 127), pack-reused 0
Receiving objects: 100% (3129/3129), 17.93 MiB | 13.41 MiB/s, done.
Resolving deltas: 100% (421/421), done.

Installing frappe
$ frappe-bench/env/bin/python -m pip install -q -U -e frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.5.0" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
$ yarn run snyk-protect
yarn run v1.22.10
$ snyk protect
Successfully applied Snyk patches

Done in 9.75s.
Done in 61.41s.
Updating node packages...

Installing node dependencies for frappe
$ yarn install
yarn install v1.22.10
[1/4] Resolving packages...
success Already up-to-date.
$ yarn run snyk-protect
yarn run v1.22.10
$ snyk protect
Successfully applied Snyk patches

Done in 7.28s.
Done in 8.27s.
$ bench build
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

Retrieving assets...

✔ Downloaded Frappe assets from https://github.com/frappe/frappe/releases/download/v13.1.2/assets.tar.gz

Extracting assets...

✔ Restored js/barcode_scanner.min.js
✔ Restored js/chat.js.map
✔ Restored js/control.min.js
✔ Restored js/user_profile_controller.min.js.map
✔ Restored js/web_form.min.js
✔ Restored js/data_import_tools.min.js.map
✔ Restored js/dialog.min.js
✔ Restored js/report.min.js
✔ Restored js/libs.min.js
✔ Restored js/checkout.min.js.map
✔ Restored js/web_form.min.js.map
✔ Restored js/control.min.js.map
✔ Restored js/form.min.js
✔ Restored js/bootstrap-4-web.min.js.map
✔ Restored js/frappe-web.min.js
✔ Restored js/chat.js
✔ Restored js/frappe-recorder.min.js
✔ Restored js/report.min.js.map
✔ Restored js/data_import_tools.min.js
✔ Restored js/desk.min.js.map
✔ Restored js/checkout.min.js
✔ Restored js/dialog.min.js.map
✔ Restored js/user_profile_controller.min.js
✔ Restored js/frappe-web.min.js.map
✔ Restored js/moment-bundle.min.js
✔ Restored js/bootstrap-4-web.min.js
✔ Restored js/list.min.js
✔ Restored js/barcode_scanner.min.js.map
✔ Restored js/desk.min.js
✔ Restored js/list.min.js.map
✔ Restored js/frappe-recorder.min.js.map
✔ Restored js/form.min.js.map
✔ Restored css/rollup.manifest.css
✔ Restored css/email.css
✔ Restored css/desk.min.css
✔ Restored css/frappe-rtl.css
✔ Restored css/frappe-web-b4.css
✔ Restored css/report.min.css
✔ Restored css/frappe-chat-web.css
✔ Restored css/login.css
✔ Restored css/web_form.css
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 37, in build
    frappe.build.bundle(no_compress, app=app, make_copy=make_copy, restore=restore, verbose=verbose, skip_frappe=skip_frappe)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 218, in bundle
    pacman = get_node_pacman()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 210, in get_node_pacman
    raise ValueError("Yarn not found")
ValueError: Yarn not found
SUCCESS: Bench frappe-bench initialized

I tried to verify the presence of yarn, it seems ok:

frappe@19d88d7cb6a1:~$ yarn
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.06s.

frappe@19d88d7cb6a1:~$ yarn --version
1.22.10

Later in the installation process, I get the same error when it comes to install erpnext:

$bench get-app --branch version-13 erpnext https://github.com/frappe/erpnext.git
Getting erpnext
$ git clone https://github.com/frappe/erpnext.git --branch version-13 --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Enumerating objects: 7493, done.
remote: Counting objects: 100% (7493/7493), done.
remote: Compressing objects: 100% (6224/6224), done.
remote: Total 7493 (delta 1940), reused 3383 (delta 987), pack-reused 0
Receiving objects: 100% (7493/7493), 18.24 MiB | 9.57 MiB/s, done.
Resolving deltas: 100% (1940/1940), done.

Installing erpnext
$ ./env/bin/python -m pip install -q -U -e ./apps/erpnext
$ yarn install
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ yarn run snyk-protect
yarn run v1.22.10
$ snyk protect
Successfully applied Snyk patches

Done in 2.20s.
Done in 15.50s.
$ bench build --app erpnext
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 37, in build
    frappe.build.bundle(no_compress, app=app, make_copy=make_copy, restore=restore, verbose=verbose, skip_frappe=skip_frappe)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 218, in bundle
    pacman = get_node_pacman()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 210, in get_node_pacman
    raise ValueError("Yarn not found")
ValueError: Yarn not found

And finally, bench start stops immediatly after being launched:

frappe@19d88d7cb6a1:~/frappe-bench$ bench start
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

21:21:12 system           | web.1 started (pid=810)
21:21:12 system           | worker_long.1 started (pid=812)
21:21:12 system           | watch.1 started (pid=816)
21:21:12 system           | schedule.1 started (pid=818)
21:21:12 system           | socketio.1 started (pid=813)
21:21:12 system           | worker_short.1 started (pid=821)
21:21:12 system           | worker_default.1 started (pid=824)
21:21:12 watch.1          | WARN: bench is installed in editable mode!
21:21:12 watch.1          |
21:21:12 watch.1          | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
21:21:12 watch.1          |
21:21:12 web.1            | WARN: bench is installed in editable mode!
21:21:12 web.1            |
21:21:12 web.1            | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
21:21:12 web.1            |
21:21:12 schedule.1       | WARN: bench is installed in editable mode!
21:21:12 schedule.1       |
21:21:12 schedule.1       | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
21:21:12 schedule.1       |
21:21:12 socketio.1       | listening on *: 9000
21:21:13 watch.1          | Traceback (most recent call last):
21:21:13 watch.1          |   File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
21:21:13 watch.1          |     "__main__", mod_spec)
21:21:13 watch.1          |   File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
21:21:13 watch.1          |     exec(code, run_globals)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
21:21:13 watch.1          |     main()
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
21:21:13 watch.1          |     click.Group(commands=commands)(prog_name='bench')
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
21:21:13 watch.1          |     return self.main(*args, **kwargs)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 717, in main
21:21:13 watch.1          |     rv = self.invoke(ctx)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
21:21:13 watch.1          |     return _process_result(sub_ctx.command.invoke(sub_ctx))
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
21:21:13 watch.1          |     return _process_result(sub_ctx.command.invoke(sub_ctx))
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
21:21:13 watch.1          |     return ctx.invoke(self.callback, **ctx.params)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
21:21:13 watch.1          |     return callback(*args, **kwargs)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 45, in watch
21:21:13 watch.1          |     frappe.build.watch(True)
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 237, in watch
21:21:13 watch.1          |     pacman = get_node_pacman()
21:21:13 watch.1          |   File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 210, in get_node_pacman
21:21:13 watch.1          |     raise ValueError("Yarn not found")
21:21:13 watch.1          | ValueError: Yarn not found
21:21:13 system           | watch.1 stopped (rc=1)
21:21:13 system           | sending SIGTERM to web.1 (pid 810)
21:21:13 system           | sending SIGTERM to socketio.1 (pid 813)
21:21:13 system           | sending SIGTERM to schedule.1 (pid 818)
21:21:13 system           | sending SIGTERM to worker_short.1 (pid 821)
21:21:13 system           | sending SIGTERM to worker_long.1 (pid 812)
21:21:13 system           | sending SIGTERM to worker_default.1 (pid 824)
21:21:13 system           | worker_short.1 stopped (rc=-15)
21:21:13 system           | worker_long.1 stopped (rc=-15)
21:21:13 system           | worker_default.1 stopped (rc=-15)
21:21:13 system           | schedule.1 stopped (rc=-15)
21:21:13 system           | web.1 stopped (rc=-15)
21:21:13 system           | socketio.1 stopped (rc=-15)

Any idea for help ?

Regards

commit 530a980ef74fd20a9de289284fde16875256b49b
fix: Use execve and set envvars instead of execv

causes this.

Reset before that commit and it’ll work.

Commit: https://github.com/frappe/bench/pull/1158/commits/530a980ef74fd20a9de289284fde16875256b49b

Thank you !