I the Node.js package apiconnect
will not install on my new MacBook Pro. The Node.js version is v10.22.1
, NPM version 6.14.6
, Python 3.8.3
I ran the following command:
sudo npm install -g --unsafe-perm=true --allow-root --loglevel verbose apiconnect
The error that I receive is similar to what I received in the container (appmetrics@3.1.3). The error from the log:
61922 silly install appmetrics@3.1.3
61923 info lifecycle appmetrics@3.1.3~install: appmetrics@3.1.3
61924 verbose lifecycle appmetrics@3.1.3~install: unsafe-perm in lifecycle true
61925 verbose lifecycle appmetrics@3.1.3~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/apiconnect/node_modules/appmetrics/node_modules/.bin:/usr/local/lib/node_modules/apiconnect/node_modules/.bin:/usr/local/lib/node_modules/.bin:/Users/steve/opt/anaconda3/bin:/Users/steve/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
61926 verbose lifecycle appmetrics@3.1.3~install: CWD: /usr/local/lib/node_modules/apiconnect/node_modules/appmetrics
61927 silly lifecycle appmetrics@3.1.3~install: Args: [ '-c', 'node extract_all_binaries.js || node-gyp rebuild' ]
61928 silly lifecycle appmetrics@3.1.3~install: Returned: code: 1 signal: null
61929 info lifecycle appmetrics@3.1.3~install: Failed to exec install script
61930 timing action:install Completed in 26347ms
61931 verbose unlock done using /Users/steve/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
61932 timing stage:rollbackFailedOptional Completed in 8528ms
61933 timing stage:runTopLevelLifecycles Completed in 468567ms
61934 verbose stack Error: appmetrics@3.1.3 install: `node extract_all_binaries.js || node-gyp rebuild`
61934 verbose stack Exit status 1
61934 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
61934 verbose stack at EventEmitter.emit (events.js:198:13)
61934 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
61934 verbose stack at ChildProcess.emit (events.js:198:13)
61934 verbose stack at maybeClose (internal/child_process.js:982:16)
61934 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
61935 verbose pkgid appmetrics@3.1.3
61936 verbose cwd /Users/steve
61937 verbose Darwin 19.6.0
61938 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "--unsafe-perm=true" "--allow-root" "--loglevel" "verbose" "apiconnect"
61939 verbose node v10.22.1
61940 verbose npm v6.14.6
61941 error code ELIFECYCLE
61942 error errno 1
61943 error appmetrics@3.1.3 install: `node extract_all_binaries.js || node-gyp rebuild`
61943 error Exit status 1
61944 error Failed at the appmetrics@3.1.3 install script.
61944 error This is probably not a problem with npm. There is likely additional logging output above.
61945 verbose exit [ 1, true ]
The issue was resolved by changing the order of the directories in my PATH
environment variable and running the install as sudo
and using the --unsafe-perm=true
and --allow-root
options.
The full command used for the installation was:
sudo npm install -g --unsafe-perm=true --allow-root --loglevel verbose apiconnect
For the PATH
environment variable, the installation of anaconda3
Python/Jupyter Notebook package put their directories at the front of the path. By changing the path to so that:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:...
where the first directories in the path, the installation worked.