bench.utils.CommandFailedError: npm install

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
frappe@ubuntu1804lts:~/frappe-bench$ npm show quill version

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

With a healthy install one should expect to see this:

frappe@ubuntu1804lts:~/frappe-bench$ which 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- 

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".

Thankyou @Arreis, finally it is working by creating a new user.

You’re welcome @Khadija. I think that running ERPNext with a separated user is the recommended way although I’m not really sure why as I’m just getting started with this.

At the end, I was also able to make it work with my regular user by removing bench ( with pip ) , uninstalling yarn ( with npm ), purging nodejs (with apt) and then installing these packages again only this time I also installed yarn with apt instead of npm.

I’m not sure what was the exact step that made ERPNext recognize yarn with my regular user, but after I did this it started working.

Ok I will try this too then

Be aware that may depend on OS and/or host environment?

@BKM notes some caveats for eg Ubuntu 18.04 -ERPNext installation - #9 by bkm

Sorry but can you explain?

Just search to find BKM’s install experience notes with Ubuntu, CentOS and Debian versions, and also VPS host environments like the Google Cloud Platform (GCP).

For ERPNext to work on the various distinct platforms that are sought may demand some trial and error for a successful install, with clues and pointers that user’s report here.

One common issue has to do with permissions - the user account must have sudo privileges, but to install as root to overcome that causes problems too.

OK now I am trying to understand all this

Did you get this error after installing with a new user
INFO:bench.utils:setting up backups
crontabs/khadija/: fopen: Permission denied
INFO:bench.utils:setting up auto update
/var/spool/cron/: mkstemp: Permission denied
crontabs/khadija/: fopen: Permission denied
Bench frappe-bench initialized
/var/spool/cron/: mkstemp: Permission denied

I did not :/. By any chance did you initialized the bench with another user? If so, either change the files ownership for the whole bench folder recursively to the new user or remove the bench and start the process from scratch with the new one.

Yes that was the problem.

yarn global add yarn

it works

You can also use

sudo npm install -g yarn

1 Like

actually, it doesn’t work for me…