Azure / pcs-cli

A CLI for deploying Azure IoT PCS
MIT License
33 stars 37 forks source link

Cannot install with npm command #541

Closed jamesmcroft closed 4 years ago

jamesmcroft commented 4 years ago

Type of issue

Description

When attempting to install from npm, the install fails even running with admin/sudo permission.

Steps to reproduce

  1. Run npm install -g iot-solutions or sudo npm install -g iot-solutions

Expected behavior

iot-solutions should install as expected.

Current behavior

Install fails with the following errors:

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
/usr/local/bin/pcs -> /usr/local/lib/node_modules/iot-solutions/publish/index.js

> websocket@1.0.31 install /usr/local/lib/node_modules/iot-solutions/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

sh: builderror.log: Permission denied

> jsonpath@1.0.1 postinstall /usr/local/lib/node_modules/iot-solutions/node_modules/jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js

sh: generated/aesprim-browser.js: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jsonpath@1.0.1 postinstall: `node lib/aesprim.js > generated/aesprim-browser.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the jsonpath@1.0.1 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/admin/.npm/_logs/2020-06-15T14_37_30_176Z-debug.log

Context and Environment

jamesmcroft commented 4 years ago

Appears this was an odd permissions issue. Manage to resolve this by configuring the NPM_CONFIG_PREFIX ENV variable.