bench.utils.CommandFailedError: npm install

No. What does it do.

Hey everyone, I’m having what it seems to be the exact same error than Khadija ( or at least that is what I think based on the log).

I tried the suggested solution about purging nodejs and installing the version 8 with the https://deb.nodesource.com/setup_8.x script followed by the apt install but it doesn’t work for me. I already repeated the same steps many times without any luck, does anybody have another suggestion?

I’m using Debian 9 Stretch, and my log is the following one :

$ bench init frappe-bench
INFO:bench.utils:virtualenv -q env -p /usr/bin/python
Already using interpreter /usr/bin/python
INFO:bench.utils:./env/bin/pip -q install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
INFO:bench.utils:./env/bin/pip -q install wheel
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
INFO:bench.utils:./env/bin/pip -q install six
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
INFO:bench.utils:./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
INFO:bench.app:getting app frappe
INFO:bench.utils:git clone https://github.com/frappe/frappe.git   --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 168239 (delta 33), reused 36 (delta 23), pack-reused 168181
Receiving objects: 100% (168239/168239), 192.95 MiB | 2.57 MiB/s, done.
Resolving deltas: 100% (128255/128255), done.
('installing', u'frappe')
INFO:bench.app:installing frappe
INFO:bench.utils:frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe --no-cache-dir
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Updating node libraries...
INFO:bench.utils:npm install
npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > uws@9.14.0 install /home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/uws
npm ERR! prepareGitDep > node-gyp rebuild > build_log.txt 2>&1 || exit 0
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > wd@1.11.1 install /home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/wd
npm ERR! prepareGitDep > node scripts/build-browser-scripts
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > sauce-connect-launcher@1.2.4 postinstall /home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/sauce-connect-launcher
npm ERR! prepareGitDep > node scripts/install.js || nodejs scripts/install.js
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > parchment@2.0.0-dev prepare /home/arreis/.npm/_cacache/tmp/git-clone-bea26042
npm ERR! prepareGitDep > npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > parchment@2.0.0-dev build /home/arreis/.npm/_cacache/tmp/git-clone-bea26042
npm ERR! prepareGitDep > webpack --config webpack.conf.js
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
npm ERR! prepareGitDep npm WARN deprecated   npm i nyc
npm ERR! prepareGitDep npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm ERR! prepareGitDep npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm ERR! prepareGitDep npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm ERR! prepareGitDep npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! prepareGitDep npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm ERR! prepareGitDep npm WARN deprecated uws@9.14.0: New code is available at github.com/uNetworking/uWebSockets.js
npm ERR! prepareGitDep npm WARN deprecated mailcomposer@4.0.1: This project is unmaintained
npm ERR! prepareGitDep npm WARN deprecated socks@1.1.9: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm ERR! prepareGitDep npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm ERR! prepareGitDep npm WARN deprecated buildmail@4.0.1: This project is unmaintained
npm ERR! prepareGitDep npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm ERR! prepareGitDep npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.
npm ERR! prepareGitDep npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm ERR! prepareGitDep /home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/webpack-cli/bin/config-yargs.js:89
npm ERR! prepareGitDep 				describe: optionsSchema.definitions.output.properties.path.description,
npm ERR! prepareGitDep 				                                           ^
npm ERR! prepareGitDep 
npm ERR! prepareGitDep TypeError: Cannot read property 'properties' of undefined
npm ERR! prepareGitDep     at module.exports (/home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/webpack-cli/bin/config-yargs.js:89:48)
npm ERR! prepareGitDep     at /home/arreis/.npm/_cacache/tmp/git-clone-bea26042/node_modules/webpack-cli/bin/webpack.js:60:27
npm ERR! prepareGitDep     at Object.<anonymous> (/home/arreis/.npm/_cacache/tmp/git-clone-bea26042/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/arreis/.npm/_logs/2019-03-13T03_43_18_648Z-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/arreis/.npm/_logs/2019-03-13T03_43_18_802Z-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/arreis/.npm/_logs/2019-03-13T03_43_18_978Z-debug.log
Traceback (most recent call last):
  File "/home/arreis/.local/bin/bench", line 11, in <module>
    sys.exit(cli())
  File "/home/arreis/.local/lib/python2.7/site-packages/bench/cli.py", line 40, in cli
    bench_command()
  File "/home/arreis/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/arreis/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/arreis/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/arreis/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/arreis/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/arreis/.local/lib/python2.7/site-packages/bench/commands/make.py", line 21, in init
    verbose=verbose, clone_from=clone_from, skip_bench_mkdir=skip_bench_mkdir, skip_redis_config_generation=skip_redis_config_generation)
  File "/home/arreis/.local/lib/python2.7/site-packages/bench/utils.py", line 72, in init
    update_npm_packages(bench_path=path)
  File "/home/arreis/.local/lib/python2.7/site-packages/bench/utils.py", line 442, in update_npm_packages
    exec_cmd('npm install', cwd=bench_path)
  File "/home/arreis/.local/lib/python2.7/site-packages/bench/utils.py", line 140, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install

Are you purging the npm or using this commands along with existing…kindly purge and run the above commands.

I’m tried running sudo apt purge nodejs & sudo apt purge build-essentials followed by sudo apt autoremove, and then the steps from above. I wasn’t able to purge npm directly as whenever I try to do that the system dispalys something like “using nodejs instead”, however, after following the steps and checking nodejs --version and npm --version I get to see both results OK.

ok are you getting the error now by initiating the bench…?

that is right, whenever I try to init the bench like this for example:

$bench init frappe-bench

No am asking are you getting the issue now after using these commands?

Oh Yes, I am. I already tried with nodejs 8 ( as suggested by the solution from this post ) , 10 , and 11 but I still have the problem.

ok explain me what are the steps you followed in installation.

Sure, I pretty much followed the
The Hitchhiker’s Guide to Installing Frappé on Linux guide, step by step which requires the folllowing to be installed before attempting to initialize the bench:

  • GIT
    $ sudo apt install git

  • Python
    Since python 2.7 already comes with Debian 9, I just installed python-dev, python-setuptools and python-pip

  • MariaDB, with the following commands.
    $ sudo apt install software-properties-common
    $ sudo apt install mariadb-server-10.3

  • MySQL database development files
    $ sudo apt install libmysqlclient-dev

    And then, I added the following to the /etc/mysql/the my.cnf

    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci

    [mysql]
    default-character-set = utf8mb4

    $ sudo service mysql restart

  • Redis
    $ sudo install redis-server

  • Curl
    $ sudo apt install curl

  • NodeJS 8.X
    $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    $ sudo apt install -y nodejs

  • Yarn
    $ sudo npm install -g yarn

I got no error until this point, and after all this software was installed, I cloned the bench with the following command:

$ git clone https://github.com/frappe/bench
$ pip install -e ./bench

Checked the Bench --version, and then I tried to initialize a bench, which is the step where I’m getting the error

Later on when I get a chance, I’m going to try purging all the software I mentioned before , and then retry the whole process from scratch to see if that fixes the issue.

yes make a try of that it would resolve your issue infact i too purged softwares for installation.

I think you need a sudo on the pip install -e ./bench

sudo pip install -e ./bench

Alright, thank you @arokia & @trentmu. I will try purging the software as well as installing the bench with sudo and let you guys know if my problem was solved.

Here’s something you might try - in this file:

frappe@ubuntu1804lts:~/frappe-bench$ ls -al package.json
-rw-rw-r-- 1 frappe frappe 1528 Mar 15 17:02 package.json

change this line

“quill”: “2.0.0-dev.2”,

to this:

“quill”: “1.3.6”,

Then the command ‘npm install’ runs and completes without errors. But be aware this change may be misguided and may break something. Note also that I did not change this:

./apps/frappe/package.json: “quill”: “2.0.0-dev.2”,

Here is a reference to quill GitHub - quilljs/quill: Quill is a modern WYSIWYG editor built for compatibility and extensibility.

These below are I figure stable versions and the 2.0.0 are development versions?

frappe@ubuntu1804lts:~/frappe-bench$ npm show parchment version
1.1.4
frappe@ubuntu1804lts:~/frappe-bench$ npm show quill version
1.3.6

edit: Possibly the reference to “quill”: “2.0.0-dev.2” needs to be changed here
frappe/package.json at develop · frappe/frappe · GitHub

Thank you so much @clarkej for the detailed suggestion. I haven’t made the time to try the solutions, but I hope I can fix my local environment this weekend.

As soon as I’m able to try this I’ll put a comment to let you all know if my problem was solved.

1 Like

@netchampfaris this is just to inform you ‘npm install’ currently errors with what seems to be this change

feat(Text Editor): Add table support by netchampfaris · Pull Request #6226 · frappe/frappe · GitHub

In yarn.lock possibly the quill dependency in reference to parchment is to blame?

npm install should not be used for installations. We use yarn, which uses yarn.lock to resolve dependencies.

@Arreis If you have yarn installed globally, bench will pick it up and use the yarn command to install dependencies.

To install yarn, you can do

npm install -g yarn

Thanks so much Faris and @Arreis please ignore my mistaken advice!

Install ran ok as expected only upon a full clean up after my failed installs -

To remove my bad install I had to rm -rf /home/frappe/bench-repo & /home/frappe/frappe-bench, but also too in my case /home/frappe/.local - this clue here made me realize this same ‘bad’ bench persisted with each install

frappe@ubuntu1804lts:~/frappe-bench$ which bench
/home/frappe/.local/bin/bench

With a healthy install one should expect to see this:

frappe@ubuntu1804lts:~/frappe-bench$ which bench
/usr/local/bin/bench

hope this helps

1 Like

Thank you all for the support, it seems like this does have to do with yarn after all.
After trying performing clean installs several times and making sure yarn was installed globally on my regular user without any luck I tried this ERPNext on Debian 9 installation guide which requires the creation of a new user under the sudo group and then I was able to initialize bench.

However, after checking the differences in the bash verbose, I noticed that when I init the bench with the new user it does use yarn to install the node packages, but when I try with my regular user it tries to use npm and I’m not sure why :confused:

verbose when trying to init bench with regular user ( the one that fails ):

Updating node libraries...
INFO:bench.utils:npm install
npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > uws@9.14.0 install /home/arreis/.npm/_cacache/tmp/git-clone- 
03b762c7/node_modules/uws

verbose when trying to init bench with new user ( the one OK ):

Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.13.0 
[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".