Mac下安装cordova-hot-code-push-cli失败

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ducp123/article/details/86150702

Mac下安装cordova-hot-code-push-cli失败,执行命令为:sudo npm i -g cordova-hot-code-push-cli

具体错误日志如下:

npm WARN deprecated [email protected]: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: renamed to d3-queue
/Users/xxx/.npm-global/bin/cordova-hcp -> /Users/shanon/.npm-global/lib/node_modules/cordova-hot-code-push-cli/bin/cordova-hcp

> [email protected] postinstall /Users/xxx/.npm-global/lib/node_modules/cordova-hot-code-push-cli/node_modules/ngrok
> node ./postinstall.js

ngrok - unpacking binary
ngrok - error unpacking binary { Error: EACCES: permission denied, open '/Users/xxx/.npm-global/lib/node_modules/cordova-hot-code-push-cli/node_modules/ngrok/bin/ngrok'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/Users/shanon/.npm-global/lib/node_modules/cordova-hot-code-push-cli/node_modules/ngrok/bin/ngrok' }
ngrok - install failed, retrying
ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
ngrok - error storing binary to local file { Error: EACCES: permission denied, open '/Users/xxx/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/Users/xxx/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip' }
ngrok - install failed, retrying
ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
ngrok - error storing binary to local file { Error: EACCES: permission denied, open '/Users/xxx/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/Users/shanon/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip' }
ngrok - install failed { Error: EACCES: permission denied, open '/Users/xxx/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/Users/xxx/.ngrok/aHR0cHM6Ly9iaW4uZXF1aW5veC5pby9jLzRWbUR6QTdpYUhiL25ncm9rLXN0YWJsZS1kYXJ3aW4tYW1kNjQuemlw.zip' }
npm WARN [email protected] requires a peer of level@~1.4.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/shanon/.npm/_logs/2019-01-08T04_03_05_057Z-debug.log

错误提示显示permission问题,然后安装ngrok失败,尝试各种方式,其实还是权限不够的问题,显示简介给了权限也没用。

最后翻阅各种帖子,我的解决方式如下:

npm config set unsafe-perm=true

执行该语句后,再执行上面的安装命令,居然成功了。

另外有些情况用如下方式也能解决,此处记录一下;

sudo npm i -g ngrok --unsafe-perm=true --allow-root

猜你喜欢

转载自blog.csdn.net/ducp123/article/details/86150702
今日推荐