Bench update v11 fails yarn issue

Hello,

i had output for

bench version
erpnext 11.1.5
frappe 11.1.5

then i ran
bench update

it failed with the below error

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/bench/cli.py", line 40, 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/frappe/.bench/bench/commands/update.py", line 32, 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 5, in execute
    exec_cmd('npm install yarn', os.path.join(bench_path, 'apps/frappe'))
  File "/home/frappe/.bench/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install yarn

Solution Tried :

  1. How to update from v10 to V11 - #44 by jignesh_shah
  2. sudo npm install -g yarn
    but still bench update fails

Workaround :
go inside each app , do
git pull
and then

bench build
bench migrate
bench restart

But i am looking for a bench update command fail solution .

Would highly appreciate your help.

Thanks

2 Likes

Try these commands then run bench update. That might be helpful.

Step 1: bench setup socketio
Step 2: bench setup requirements

1 Like

sudo apt-get install build-essential use this command and share the outputā€¦

Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
build-essential is already the newest version (12.4ubuntu1).
The following package was automatically installed and is no longer required:
grub-pc-bin
Use ā€˜sudo apt autoremoveā€™ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.

have you installed npm succesfully? If not follow the link bench.utils.CommandFailedError: npm install - #8 by arokia
and follow below commands:

1 Like

No , i was unable to install npm successfully.

I purged npm & nodejs thru this command
sudo apt-get purge --auto-remove nodejs
sudo apt-get purge --auto-remove npm

and tried to follow the steps given in the bench.utils.CommandFailedError: npm install - #8 by arokia
but i got the below error when executed npm install command

sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 npm : Depends: nodejs but it is not going to be installed
       Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
       Depends: node-ansi (>= 0.3.0-2) but it is not going to be installed
       Depends: node-ansi-color-table but it is not going to be installed
       Depends: node-archy but it is not going to be installed
       Depends: node-block-stream but it is not going to be installed
       Depends: node-fstream (>= 0.1.22) but it is not going to be installed
       Depends: node-fstream-ignore but it is not going to be installed
       Depends: node-github-url-from-git but it is not going to be installed
       Depends: node-glob (>= 3.1.21) but it is not going to be installed
       Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
       Depends: node-inherits but it is not going to be installed
       Depends: node-ini (>= 1.1.0) but it is not going to be installed
       Depends: node-lockfile but it is not going to be installed
       Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
       Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
       Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
       Depends: node-gyp (>= 0.10.9) but it is not going to be installed
       Depends: node-nopt (>= 3.0.1) but it is not going to be installed
       Depends: node-npmlog but it is not going to be installed
       Depends: node-once but it is not going to be installed
       Depends: node-osenv but it is not going to be installed
       Depends: node-read but it is not going to be installed
       Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
       Depends: node-request (>= 2.25.0) but it is not going to be installed
       Depends: node-retry but it is not going to be installed
       Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
       Depends: node-semver (>= 2.1.0) but it is not going to be installed
       Depends: node-sha but it is not going to be installed
       Depends: node-slide but it is not going to be installed
       Depends: node-tar (>= 0.1.18) but it is not going to be installed
       Depends: node-underscore but it is not going to be installed
       Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

run the following commands sudo aptitude install and sudo aptitude install npm it asks some Y or
N give that correctly.

After following all your steps , i reached at the last command
sudo apt-get update && sudo apt-get install yarn

E: Type 'ā€œdeb' is not known on line 1 in source list /etc/apt/sources.list.d/yarn.list
E: The list of sources could not be read.

But got the above error.

FYI ,
nodejs -v
v8.15.1
npm -v
6.4.1

run this commands separately
sudo apt update
sudo apt install yarn

sudo apt update
[sudo] password for frappe:
E: Type ā€˜ā€œdebā€™ is not known on line 1 in source list /etc/apt/sources.list.d/yarn.list
E: The list of sources could not be read.

removed " (quotation) from the /etc/apt/sources.list.d/yarn.list ,
sudo nano /etc/apt/sources.list.d/yarn.list
it seems worked.
installed yarn
sudo apt update
sudo apt install yarn

yarn version
yarn version v1.13.0
error Couldn't find a package.json file in "/home/frappe"
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.

Its not an issue just go to frappe bench and start.

1 Like

I think you have got the solutionā€¦

Thanks for the amazing helpā€¦
Will update you know once the server is not in production useā€¦ i want to test if
bench update command works without any error !

ok sure if it doesnt work revert back to me.

1 Like

Still bench update fails with the below error.

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/bench/cli.py", line 40, 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/frappe/.bench/bench/commands/update.py", line 32, 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 5, in execute
    exec_cmd('npm install yarn', os.path.join(bench_path, 'apps/frappe'))
  File "/home/frappe/.bench/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install yarn

What version of pip do you have? My setup failed (with an npm error) because I was downgrading to v9.03 (instead of the default of v19.03 of pip). When I updated pip to 19.03 it worked perfectly

python -m pip install --user pip==19.0.3 #On the 9.03 version, I got yarn exit errors

As such for me
pip --version
pip 19.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Should i upgrade to pip 19.0.3 thru below command ?

pip install --upgrade pip

I used thisā€¦ (as user frappe)

python -m pip install --user pip==19.0.3

but your command should work just as well

no success ! still bench update fails .

 TypeError: Cannot read property 'properties' of undefined
npm ERR! prepareGitDep     at module.exports (/home/frappe/.npm/_cacache/tmp/git-clone-01394b49/node_modules/webpack-cli/bin/config-yargs.js:89:48)
npm ERR! prepareGitDep     at /home/frappe/.npm/_cacache/tmp/git-clone-01394b49/node_modules/webpack-cli/bin/webpack.js:60:27
npm ERR! prepareGitDep     at Object.<anonymous> (/home/frappe/.npm/_cacache/tmp/git-clone-01394b49/node_modules/webpack-cli/bin/webpack.js:515:3)
npm ERR! prepareGitDep     at Module._compile (module.js:653:30)
npm ERR! prepareGitDep     at Object.Module._extensions..js (module.js:664:10)
npm ERR! prepareGitDep     at Module.load (module.js:566:32)
npm ERR! prepareGitDep     at tryModuleLoad (module.js:506:12)
npm ERR! prepareGitDep     at Function.Module._load (module.js:498:3)
npm ERR! prepareGitDep     at Module.require (module.js:597:17)
npm ERR! prepareGitDep     at require (internal/module.js:11:18)
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! parchment@2.0.0-dev build: `webpack --config webpack.conf.js`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the parchment@2.0.0-dev build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/frappe/.npm/_logs/2019-03-15T03_32_18_469Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! parchment@2.0.0-dev prepare: `npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the parchment@2.0.0-dev prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/frappe/.npm/_logs/2019-03-15T03_32_18_592Z-debug.log
npm ERR! prepareGitDep
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: parchment@github:quilljs/parchment#487850f7eb030a6c4e750ba809e58b09444e0bdb.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/frappe/.npm/_logs/2019-03-15T03_32_19_111Z-debug.log
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/bench/cli.py", line 40, 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/frappe/.bench/bench/commands/update.py", line 32, 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 5, in execute
    exec_cmd('npm install yarn', os.path.join(bench_path, 'apps/frappe'))
  File "/home/frappe/.bench/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install yarn