欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

解决Mac下安装nmp的淘宝镜像失败问题

程序员文章站 2022-04-10 17:53:16
安装命令如下: npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose...

安装命令如下:

npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose

提示报错,信息如下:

npm err! darwin 16.6.0
npm err! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cnpm" "--registry=https://registry.npm.taobao.org" "--verbose"
npm err! node v6.11.0
npm err! npm v3.10.10
npm err! path ../lib/node_modules/cnpm/bin/cnpm
npm err! code eacces
npm err! errno -13
npm err! syscall symlink

npm err! error: eacces: permission denied, symlink '../lib/node_modules/cnpm/bin/cnpm' -> '/usr/local/bin/cnpm'
npm err!  at error (native)
npm err! { error: eacces: permission denied, symlink '../lib/node_modules/cnpm/bin/cnpm' -> '/usr/local/bin/cnpm'
npm err!  at error (native)
npm err! errno: -13,
npm err! code: 'eacces',
npm err! syscall: 'symlink',
npm err! path: '../lib/node_modules/cnpm/bin/cnpm',
npm err! dest: '/usr/local/bin/cnpm' }
npm err! 
npm err! please try running this command again as root/administrator.
npm verb exit [ -13, true ]

npm err! please include the following file with any support request:
npm err!  /users/xxx/npm-debug.log

注意到这一句提示:

please try running this command again as root/administrator 

于是将命令最后改为如下所示,成功安装

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose

以上这篇解决mac下安装nmp的淘宝镜像失败问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。