npm install for mediasoup-demo git fails for both server and app in mac

Here’s the output of npm install under server

ROHNIGAM-M-N1FM:server rohnigam$ npm install

clang-tools-prebuilt@0.1.4 postinstall /Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/clang-tools-prebuilt
node install.js

unziping /Users/rohnigam/.clang-tools/clang-tools-r298696-mac.tgz

mediasoup@3.2.5 postinstall /Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/mediasoup
make -C worker

python ./scripts/configure.py -R mediasoup-worker
[’-R’, ‘mediasoup-worker’, ‘/Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/mediasoup/worker/mediasoup-worker.gyp’, ‘-I’, ‘/Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/mediasoup/worker/common.gypi’, ‘–depth=.’, ‘-f’, ‘make’, ‘-Goutput_dir=/Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/mediasoup/worker/out’, ‘–generator-output’, ‘/Users/rohnigam/poc/mediasoup-source-code/mediasoup-demo/server/node_modules/mediasoup/worker/out’, ‘-Dgcc_version=42’, ‘-Dclang=1’, ‘-Dhost_arch=x64’, ‘-Dtarget_arch=x64’, ‘-Dopenssl_fips=’, ‘-Dmediasoup_asan=false’, ‘-Dnode_byteorder=little’]
xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance
Traceback (most recent call last):
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 1398, in XcodeVersion
version_list = GetStdout([‘xcodebuild’, ‘-version’]).splitlines()
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 1454, in GetStdout
sys.stderr.write(out + b’\n’)
TypeError: write() argument must be str, not bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “./scripts/configure.py”, line 111, in
run_gyp(gyp_args)
File “./scripts/configure.py”, line 49, in run_gyp
rc = gyp.main(args)
File “./deps/gyp/pylib/gyp/init.py”, line 545, in main
return gyp_main(args)
File “./deps/gyp/pylib/gyp/init.py”, line 530, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File “./deps/gyp/pylib/gyp/generator/make.py”, line 2210, in GenerateOutput
part_of_all=qualified_target in needed_targets)
File “./deps/gyp/pylib/gyp/generator/make.py”, line 820, in Write
self.Pchify))
File “./deps/gyp/pylib/gyp/generator/make.py”, line 1215, in WriteSources
cflags = self.xcode_settings.GetCflags(configname)
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 630, in GetCflags
archs = self.GetActiveArchs(self.configname)
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 488, in GetActiveArchs
xcode_archs_default = GetXcodeArchsDefault()
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 120, in GetXcodeArchsDefault
xcode_version, _ = XcodeVersion()
File “./deps/gyp/pylib/gyp/xcode_emulation.py”, line 1409, in XcodeVersion
version = re.match(r’(\d.\d.?\d*)’, version).groups()[0]
AttributeError: ‘NoneType’ object has no attribute ‘groups’
make: *** [default] Error 1
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mediasoup@3.2.5 postinstall: make -C worker
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mediasoup@3.2.5 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rohnigam/.npm/_logs/2019-08-31T12_03_51_648Z-debug.log

Here’s the output of npm install under app:

ROHNIGAM-M-N1FM:app rohnigam$ npm install
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! Unexpected end of JSON input while parsing near ‘…/seedrandom":"~2.4.27’

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rohnigam/.npm/_logs/2019-08-31T12_08_07_413Z-debug.log

Mac Version

ROHNIGAM-M-N1FM:Downloads rohnigam$ uname -a
Darwin ROHNIGAM-M-N1FM 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun 2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64

NPM version

ROHNIGAM-M-N1FM:Downloads rohnigam$ npm -v

6.10.0

Python version

ROHNIGAM-M-N1FM:Downloads rohnigam$ python --version

Python 3.6.5 :: Anaconda, Inc.

Thanks for your help, and your tool definitely looks awesome :slightly_smiling_face:

Honestly no idea. I have no problem with a fresh installation of the demo app.

$ uname -a
Darwin ibc-macbook 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

$ python3 --version
Python 3.7.2

$ npm -v
6.11.2

No idea about the “JSON parsing” error, honestly.

BTW I use python version 2, but I’ve also tested with python 3:

server/ $ PYTHON=python3 npm install

You can also try by setting PYTHON env variable to python2.