/bin/sh: 1: snyk: not found when bench update

did you found solution for this?

No, I still get the same error.

My few updated instances all have a more recent version of yarn?

frappe@ubuntu1804lts:~/frappe-bench$ bench version
erpnext 12.x.x-develop
frappe 12.x.x-develop
frappe@ubuntu1804lts:~/frappe-bench$ yarn -v
1.21.1

Before you run

bench update

you may want to run

apt-get update && apt-get upgrade -y

You are also still running Python 2.7?

~/frappe-bench$ yarn -v
1.15.2
~/frappe-bench$ pyhton --version
Python 3.6.9

After doing the update and upgrade, I still get the same error when updating bench

Two problems here, you refer to pyhton and your original traceback refers to 2.7?

Sorry, I meant “python --version”
And yes, ‘bench update’ uses version 2.7
How can I make ‘bench update’ use version 3.6 ?

Here, it is:

yarn install v1.19.1

Also try: bench migrate-env python3 (backup first, of course)

benjamien@ubuntu:~/frappe-bench$ sudo yarn install v1.19.1
yarn install v1.22.0
info No lockfile found.
error `install` has been replaced with `add` to add new dependencies. Run "yarn add v1.19.1" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

So changed it to

benjamien@ubuntu:~/frappe-bench$ sudo yarn add v1.19.1
yarn add v1.22.0
info No lockfile found.
[1/4] Resolving packages…
error An unexpected error occurred: “https://registry.yarnpkg.com/v1.19.1: Not found”.
info If you think this is a bug, please open a bug report with the information provided in “/home/benjamien/frappe-bench/yarn-error.log”.
info Visit yarn add | Yarn for documentation about this command.

Bench migrate-env python seems to work, and gave me

benjamien@ubuntu:~/frappe-bench$ bench migrate-env python3
DEBUG:bench.utils:Clearing Redis Cache...
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHALL
OK
DEBUG:bench.utils:Clearing Redis DataBase...
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHDB
OK
DEBUG:bench.utils:Backing up Virtual Environment
DEBUG:bench.utils:Setting up a New Virtual /usr/bin/python3 Environment
INFO:bench.utils:/usr/local/bin/virtualenv --python /usr/bin/python3 /home/benjamien/frappe-bench/env
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/benjamien/frappe-bench/env/bin/python3
Also creating executable in /home/benjamien/frappe-bench/env/bin/python
Installing setuptools, pip, wheel...
done.
INFO:bench.utils:/home/benjamien/frappe-bench/env/bin/pip install -q -U -e apps/frappe -e apps/erpnext
ERROR: frontmatter 3.0.5 has requirement PyYAML==3.13, but you'll have pyyaml 5.1 which is incompatible.
DEBUG:bench.utils:Migration Successful to /usr/bin/python3

But bench update still is not working. And it still refers to python 2.7

ok good now do this:

alias python=python3

then rerun the update and post the log with whatever error still occurs?

BTW the update runs a backup…

I did that, but I still get the same error.

INFO:bench.utils:yarn install
yarn install v1.15.2
warning package.json: Potential typo "devdependencies", did you mean "devDependencies"?
warning Potential typo "devdependencies", did you mean "devDependencies"?
[1/4] Resolving packages...
success Nothing to install.
success Saved lockfile.
$ yarn run snyk-protect
yarn run v1.15.2
warning package.json: Potential typo "devdependencies", did you mean "devDependencies"?
$ snyk protect
/bin/sh: 1: snyk: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/benjamien/bench-repo/bench/cli.py", line 42, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/benjamien/bench-repo/bench/commands/update.py", line 68, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/home/benjamien/bench-repo/bench/commands/update.py", line 92, in _update
    update_node_packages(bench_path=bench_path)
  File "/home/benjamien/bench-repo/bench/utils.py", line 497, in update_node_packages
    update_yarn_packages(bench_path)
  File "/home/benjamien/bench-repo/bench/utils.py", line 510, in update_yarn_packages
    exec_cmd('yarn install', cwd=app_path)
  File "/home/benjamien/bench-repo/bench/utils.py", line 194, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

What does npm -v return? Does bench setup requirements complete ok?

npm -v returns
6.11.3

Below is the full output for bench update

benjamien@ubuntu:~/frappe-bench$ bench update
INFO:bench.utils:Updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:Bench Updated!
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.6/site-packages (6.2.2)
Backing up sites…
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream develop
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch develop → FETCH_HEAD
    Already up to date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream develop
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch develop → FETCH_HEAD
    Already up to date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling betoled_integration
    INFO:bench.utils:git pull upstream master
    Password for ‘https://betoware@bitbucket.org’:
    From https://bitbucket.org/betoware/erpnext_betoled_integration
  • branch master → FETCH_HEAD
    Already up to date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install -q -U pip
    INFO:bench.utils:/usr/bin/python -m pip install --user -q -U -r /home/benjamien/bench-repo/requirements.txt
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at Release process - pip documentation v24.1.dev0
    INFO:bench.app:installing frappe
    INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/frappe
    INFO:bench.app:installing erpnext
    INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/erpnext
    INFO:bench.app:installing betoled_integration
    INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/betoled_integration
    Updating node packages…
    INFO:bench.utils:yarn install
    yarn install v1.15.2
    [1/4] Resolving packages…
    [2/4] Fetching packages…
    [3/4] Linking dependencies…
    warning " > bootstrap@4.3.1" has unmet peer dependency “jquery@1.9.1 - 3”.
    warning " > bootstrap@4.3.1" has unmet peer dependency “popper.js@^1.14.7”.
    [4/4] Building fresh packages…
    success Saved lockfile.
    $ yarn run snyk-protect
    yarn run v1.15.2
    $ snyk protect
    Successfully applied Snyk patches

Done in 5.91s.
Done in 18.30s.
INFO:bench.utils:yarn install
yarn install v1.15.2
warning package.json: Potential typo “devdependencies”, did you mean “devDependencies”?
warning Potential typo “devdependencies”, did you mean “devDependencies”?
[1/4] Resolving packages…
success Nothing to install.
success Saved lockfile.
$ yarn run snyk-protect
yarn run v1.15.2
warning package.json: Potential typo “devdependencies”, did you mean “devDependencies”?
$ snyk protect
/bin/sh: 1: snyk: not found
error Command failed with exit code 127.
info Visit yarn run | Yarn for documentation about this command.
error Command failed with exit code 127.
info Visit yarn install | Yarn for documentation about this command.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/benjamien/bench-repo/bench/cli.py”, line 42, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/benjamien/bench-repo/bench/commands/update.py”, line 68, in update
_update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
File “/home/benjamien/bench-repo/bench/commands/update.py”, line 92, in _update
update_node_packages(bench_path=bench_path)
File “/home/benjamien/bench-repo/bench/utils.py”, line 497, in update_node_packages
update_yarn_packages(bench_path)
File “/home/benjamien/bench-repo/bench/utils.py”, line 510, in update_yarn_packages
exec_cmd(‘yarn install’, cwd=app_path)
File “/home/benjamien/bench-repo/bench/utils.py”, line 194, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

This shows that the problem is python uses python2.7 when what you want to invoke is python3, hence to use alias python=python3 as this advises python3 - How to make 'python' program command execute Python 3? - Ask Ubuntu

alias python=python3

is already in ~/.bashrc
output:

benjamien@ubuntu:~$ python --version
Python 3.6.9
benjamien@ubuntu:~$ \python --version
Python 2.7.17

Hello,

Please try by creating snyk.json file at location ~/.config/configstore/
before that give permissions to the folder by
sudo chmod 0777 ~/.config/configstore/
then create file
sudo touch snyk.json

If you find snyk.json followed by some number created then remove that file and again do the setup.

Hope this will help.

Hi,

Tried that, but it doesn’t change anything.
Still the same error.

HI, have you got any solution for this issue, I am also facing the same issue.

Can anyone confirm this PR solves the issue?

At best, it removes the warning for possible typo. Although the previous package.json worked fine for me with yarn 1.19.1

1 Like

The update runs without error.
But now my erpnext shows “Internal Server Error”

After doing
sudo supervisorctl restart all
it all worked again

Thank you !!

1 Like