Npm fails to parse JSON data on bench init

First post. Thanks for a very interesting frappe framework, which I am eager to learn in detail and to which I eventually hope to contribute.

Following the Manual Install guide for frappe/bench, I’ve managed to overcome a number of hurdles thanks in large part to previous posts in this discussion forum. Now appear to be very close to completing a successful init, but here’s an issue for which I’ve not seen a prior discussion and solution. npm appears to be croaking on the file ‘/home/ubuntu/.npm/yeast/0.1.2/package/package.json’ and it is pointing fingers at the package author.

Can anyone please confirm from scanning the following output whether this is indeed the case and how I should attempt to resolve this issue?

I’m working this in a Vagrant/Virtualbox environment, as can be deduced from the terminal output, just below. Following on, I’ve pasted in the relevant tail-end of the npm-debug.log. Thanks.

ubuntu@ubuntu-xenial:~$ bench init frappe-bench && cd frappe-bench
Already using interpreter /usr/bin/python
INFO:bench.app:getting app frappe
Cloning into ‘frappe’…
remote: Counting objects: 1763, done.
remote: Compressing objects: 100% (1640/1640), done.
remote: Total 1763 (delta 202), reused 685 (delta 71), pack-reused 0
Receiving objects: 100% (1763/1763), 11.26 MiB | 482.00 KiB/s, done.
Resolving deltas: 100% (202/202), done.
Checking connectivity… done.
installing frappe
INFO:bench.app:installing frappe
npm ERR! Linux 4.4.0-38-generic
npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “socket.io” “redis” “express” “superagent” “cookie”
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! file /home/ubuntu/.npm/yeast/0.1.2/package/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected end of input at 1:1413
npm ERR! {“url”:"https://github.com/mokesmokes/backo/issues"},“homepage”:"http
npm ERR! ^
npm ERR! File: /home/ubuntu/.npm/yeast/0.1.2/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/frappe-bench/npm-debug.log
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/ubuntu/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/bench-repo/bench/commands/make.py”, line 19, in init
verbose=verbose, clone_from=clone_from)
File “/home/ubuntu/bench-repo/bench/utils.py”, line 64, in init
setup_socketio(bench_path=path)
File “/home/ubuntu/bench-repo/bench/utils.py”, line 137, in setup_socketio
exec_cmd(“npm install socket.io redis express superagent cookie”, cwd=bench_path)
File “/home/ubuntu/bench-repo/bench/utils.py”, line 127, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install socket.io redis express superagent cookie
ubuntu@ubuntu-xenial:~$

Extracted from frappe-bench/npm-debug.log:

2829 silly addNamed yeast@0.1.2
2830 verbose addNamed “0.1.2” is a plain semver version for yeast
2831 silly mapToRegistry name yeast
2832 silly mapToRegistry using default registry
2833 silly mapToRegistry registry https://registry.npmjs.org/
2834 silly mapToRegistry uri https://registry.npmjs.org/yeast
2835 verbose addNameVersion registry:https://registry.npmjs.org/yeast not in flight; fetching
2836 verbose get https://registry.npmjs.org/yeast not expired, no request
2837 silly cache afterAdd xmlhttprequest-ssl@1.5.1
2838 verbose afterAdd /home/ubuntu/.npm/xmlhttprequest-ssl/1.5.1/package/package.json not in flight; writing
2839 verbose afterAdd /home/ubuntu/.npm/xmlhttprequest-ssl/1.5.1/package/package.json written
2840 silly cache afterAdd ws@1.0.1
2841 verbose afterAdd /home/ubuntu/.npm/ws/1.0.1/package/package.json not in flight; writing
2842 verbose afterAdd /home/ubuntu/.npm/ws/1.0.1/package/package.json written
2843 silly rollbackFailedOptional Starting
2844 silly rollbackFailedOptional Finishing
2845 silly runTopLevelLifecycles Starting
2846 silly runTopLevelLifecycles Finishing
2847 silly install printInstalled
2848 verbose stack Error: Failed to parse json
2848 verbose stack Unexpected end of input at 1:1413
2848 verbose stack {“url”:"https://github.com/mokesmokes/backo/issues"},“homepage”:"http
2848 verbose stack ^
2848 verbose stack at parseError (/usr/share/npm/node_modules/read-package-json/read-json.js:379:11)
2848 verbose stack at parseJson (/usr/share/npm/node_modules/read-package-json/read-json.js:68:23)
2848 verbose stack at /usr/share/npm/node_modules/read-package-json/read-json.js:48:5
2848 verbose stack at /usr/share/npm/node_modules/graceful-fs/graceful-fs.js:76:16
2848 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
2849 verbose cwd /home/ubuntu/frappe-bench
2850 error Linux 4.4.0-38-generic
2851 error argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “socket.io” “redis” “express” “superagent” “cookie”
2852 error node v4.2.6
2853 error npm v3.5.2
2854 error file /home/ubuntu/.npm/yeast/0.1.2/package/package.json
2855 error code EJSONPARSE
2856 error Failed to parse json
2856 error Unexpected end of input at 1:1413
2856 error {“url”:"https://github.com/mokesmokes/backo/issues"},“homepage”:"http
2856 error ^
2857 error File: /home/ubuntu/.npm/yeast/0.1.2/package/package.json
2858 error Failed to parse package.json data.
2858 error package.json must be actual JSON, not just JavaScript.
2858 error
2858 error This is not a bug in npm.
2858 error Tell the package author to fix their package.json file. JSON.parse
2859 verbose exit [ 1, true ]

Seems like an npm install issue. Maybe you lost network (or just search for npm issues on the net)

Thanks for your reply. Your suspicion of an npm install issue became my main theory too upon noticing the file .npm/yeast/0.1.2/package/package.json was incomplete with no EOF. so I deleted the .npm directory along with frappe-bench directory, purged and reinstalled npm with apt and finally ran bench init frappe-bench again with better success. However, a warning is output. Here is the relevant bit, which appears following output of the install file tree:

npm WARN enoent ENOENT: no such file or directory, open ‘/home/ubuntu/frappe-bench/package.json’
npm WARN frappe-bench No description
npm WARN frappe-bench No repository field.
npm WARN frappe-bench No README data
npm WARN frappe-bench No license field.
Wrote ./assets/js/print_format_v3.min.js - 18k
Wrote ./assets/js/frappe-web.min.js - 132k
Wrote ./assets/js/form.min.js - 137k
Wrote ./assets/js/report.min.js - 158k
Wrote ./assets/css/list.min.css - 6k
Wrote ./assets/js/d3.min.js - 343k
Wrote ./assets/css/report.min.css - 8k
Wrote ./assets/css/frappe-web.css - 54k
Wrote ./assets/js/list.min.js - 103k
Wrote ./assets/js/dialog.min.js - 62k
Wrote ./assets/js/desk.min.js - 247k
Wrote ./assets/css/form.min.css - 4k
Wrote ./assets/js/editor.min.js - 26k
Wrote ./assets/js/libs.min.js - 883k
Wrote ./assets/css/desk.min.css - 265k
Wrote ./assets/css/module.min.css - 2k
INFO:bench.utils:setting up backups
INFO:bench.utils:setting up auto update
Bench frappe-bench initialized
ubuntu@ubuntu-xenial:~$

It’s a mystery to me why the file in question is simply absent or what is its origin, because presumably I could copy it in the place indicated if I knew where it resides.

At any rate, I’m a bit further along, having attended to several warnings output by redis following bench start. Nginx is running and displays on localhost:8080 whilst localhost:8000 does not make any connection. In short, ERPNext doesn’t appear and as yet I’ve not encountered any indication as to why.

If anybody has any theories about this, please chime in. Thanks.