[FIXED] Yarn error on bench update

@netchampfaris still not working:

User frappe cannot run "/bin/npm install -g yarn" as root.
Traceback (most recent call last):
  File "/usr/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/update.py", line 30, in update
    patches.run(bench_path='.')
  File "/home/frappe/.bench/bench/patches/__init__.py", line 21, in run
    result = execute(bench_path)
  File "/home/frappe/.bench/bench/patches/v4/install_yarn.py", line 4, in execute
    subprocess.check_output(['sudo', 'npm', 'install', '-g', 'yarn'])
  File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['sudo', 'npm', 'install', '-g', 'yarn']' returned non-zero exit status 1
1 Like

Same here on Debian 8.1.

I had to go to bench-repo directory and do a

git pull

After this, the bench update works again.

Cheers,
–thomas

have you updated bench ?

Same issue here. Cannot update. git pull did not help.

Pushed a fix. Please try again.

Yes, updated

Oh ok …I will try and get back

Same here on MacOS
Time: CET 13:28

bench update –> bench.utils.CommandFailedError: ./node_modules/.bin/yarn install

last fix is working for me on CentOS7 …thx

1 Like

error still there when running bench update. is there something i need to run before bench update? using ubuntu 14

The patch didn’t seem to have any effect on my system.

I just installed yarn through npm install yarn which returns a warning message

npm WARN deprecated yarn@1.3.2: It is recommended to install Yarn using the native installation method for your environment. See https://yarnpkg.com/en/docs/install

After that bench update works.

Now If I run bench update again I get an error:

Updating node libraries...
INFO:bench.utils:./node_modules/.bin/yarn install
/bin/sh: ./node_modules/.bin/yarn: No such file or directory
Traceback (most recent call last):
  File "/Users/dominik/Dev/frappe-dev/.venv/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/Users/dominik/Dev/frappe-dev/.venv/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/dominik/Dev/frappe-dev/.venv/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/dominik/Dev/frappe-dev/.venv/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/dominik/Dev/frappe-dev/.venv/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/dominik/Dev/frappe-dev/.venv/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/commands/update.py", line 58, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, force=force, reset=reset)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/commands/update.py", line 75, in _update
    update_npm_packages(bench_path=bench_path)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/utils.py", line 437, in update_npm_packages
    exec_cmd('./node_modules/.bin/yarn install', cwd=app_path)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/utils.py", line 142, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./node_modules/.bin/yarn install

Hi all,

same here on Debian 9. It can be resolved with

$ sudo chown -R frappe:frappe /usr/lib/node_modules

With that, the new yarn works like a charm.

Note: yarn.lock should be added to the .gitignore file.

2 Likes

Hi,

I tried running bench update again, but am again getting the same error:

subprocess.CalledProcessError: Command ‘[‘sudo’, ‘npm’, ‘install’, ‘-g’, ‘yarn’]’ returned non-zero exit status 1

I pushed a fix. Please update your bench.

how im going to update my bench if the problem is "bench update doens’t work "

1 Like

The command bench update updates bench itself first. If for some reason your bench is not updated, then cd into ~/.bench folder (or wherever your bench is installed) and do a git pull

4 Likes

Following command fixed my issue on new ubuntu 16.04

sudo npm install -g yarn
bench update --requirements
bench setup socketio
bench build
2 Likes

I can confirm, that bench update works without any errors and without any sudo npm commands etc. on MacOS at 5PM CET. It also worked on our Ubuntu 17.10 server. Thank you for fixing this so fast.

I believe this can be closed.

1 Like