[Solved] bench.utils.CommandFailedError: yarn install

Hello,

I recently installed erpnext 12 deployment on debian 10 on my local machine and everything was working perfectly. Then I decided to run bench update which gave me this

➜  frappe-bench sudo bench update            
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.7/site-packages (6.1.0)
Backing up sites...


Cannot proceed with update: You have local changes in app "erpnext" that are not committed.

Here are your choices:

1. Merge the erpnext app manually with "git pull" / "git pull --rebase" and fix conflicts.
1. Temporarily remove your changes with "git stash" or discard them completely
	with "bench update --reset" or for individual repositries "git reset --hard"
2. If your changes are helpful for others, send in a pull request via GitHub and
	wait for them to be merged in the core.

After running bench update I am stuck with this message on the front end.
Screenshot_2019-08-09_10-35-14

Then I ran bench update --reset and it gives me this error at the end.

➜  frappe-bench sudo bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.7/site-packages (6.1.0)
Backing up sites...
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/version-12
HEAD is now at b1322ba5e Merge branch 'version-12-hotfix' into version-12
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/version-12
HEAD is now at 9335cdd536 Merge branch 'version-12-hotfix' into version-12
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
Requirement already up-to-date: pip in ./env/lib/python3.7/site-packages (19.2.1)
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/bench-repo/requirements.txt
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/frappe 
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext 
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.17.3
warning ../../package.json: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.01s.
INFO:bench.utils:yarn install
yarn install v1.17.3
warning ../../package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "/home/frappe/.cache/yarn/v4/npm-core-js-2.6.1-87416ae817de957a3f249b3b5ca475d4aaed6042/node_modules/core-js/.yarn-metadata.json: Unexpected end of JSON input".
info If you think this is a bug, please open a bug report with the information provided in "/home/frappe/frappe-bench/apps/erpnext/yarn-error.log".
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/frappe/bench-repo/bench/cli.py", line 40, in cli
bench_command()
  File "/home/frappe/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
  File "/home/frappe/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 61, in update
_update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 85, in _update
update_node_packages(bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 454, in update_node_packages
update_yarn_packages(bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 467, in update_yarn_packages
exec_cmd('yarn install', cwd=app_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

Also here’s my ‘/home/frappe/frappe-bench/apps/erpnext/yarn-error.log’ just in case.

@NoobieWanKenobie

A little search:

Hope it helps.

I tried doing it but gives me the same error. It seems my system is not able to run any update.
Appreciate your effort. :+1:

1 Like

Are you switching to correct branch?

I mean you should switch to 12 master

$ bench switch-to-branch version-12 frappe erpnext
$ bench update

1 Like

I tried running bench switch-to-branch version-12 frappe erpnext and bench update --patch. The issued seemed to be gone but as soon as I run bench update it comes back again.

At least I’m able to continue with my work on the frond end and meanwhile I’ll open an issue on github.

Hi @NoobieWanKenobie,
Have you installed yarn or stuck in the issue?

Like mentioned in error the problem it seems was in /home/frappe/.cache/yarn/v4/npm-core-js-2.6.1-87416ae817de957a3f249b3b5ca475d4aaed6042/node_modules/core-js/.yarn-metadata.json file.

I removed the above file and reinstalled yarn, then everything worked perfectly.

4 Likes