zoukankan      html  css  js  c++  java
  • Mac电脑使用:通过Mac终端安装淘宝镜像报错,提示无权限的解决方法

    最近在开发过程中,遇到了给Mac电脑装淘宝镜像遇到的一个无权限问题,也就是Mac电脑的终端默认情况下打开的是普通用户模式,安装淘宝镜像需要打开管理员模式才行,所以在执行命令的时候不用管理员模式的话,就会提示无权限。

    本篇博文就来分享一下解决安装淘宝镜像的时候提示无权限的方法,其实只要在执行安装淘宝镜像命令前面加上管理员权限就行了,具体的报错提示以及解决方法如下所示。

    Mac电脑终端执行下载安装淘宝镜像命令:npm install -g cnpm --registry=https://registry.npm.taobao.org 之后的报错无权限的提示如下所示:

    Mac-mini:~ Chen$ npm install -g cnpm --registry=https://registry.npm.taobao.org
    
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
    
    npm ERR! code EACCES
    
    npm ERR! syscall access
    
    npm ERR! path /usr/local/lib/node_modules
    
    npm ERR! errno -13
    
    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
    
    npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
    
    npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
    
    npm ERR! errno: -13,
    
    npm ERR! code: 'EACCES',
    
    npm ERR! syscall: 'access',
    
    npm ERR! path: '/usr/local/lib/node_modules'
    
    npm ERR! }
    
    npm ERR!
    
    npm ERR! The operation was rejected by your operating system.
    
    npm ERR! It is likely you do not have the permissions to access this file as the current user
    
    npm ERR!
    
    npm ERR! If you believe this might be a permissions issue, please double-check the
    
    npm ERR! permissions of the file and its containing directories, or try running
    
    npm ERR! the command again as root/Administrator.
    
    npm ERR! A complete log of this run can be found in:
    
    npm ERR! /Users/Chen/.npm/_logs/2020-01-11T01_02_02_782Z-debug.log

    上述问题的解决步骤:

    使用这个命令:sudo npm install -g express-generator 也会有问题;

    使用这个命令:sudo npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose 就可以安装成功了。

    安装成功提示如下所示:

    npm timing action:postinstall Completed in 219ms

    npm verb unlock done using /Users/Chen/.npm/_locks/staging-3a08f84d.lock for /usr/local/lib/node_modules/.staging

    npm timing stage:executeActions Completed in 10194ms

    npm timing stage:rollbackFailedOptional Completed in 2ms

    npm timing stage:runTopLevelLifecycles Completed in 19473ms

    + cnpm@6.1.1

    added 681 packages from 942 contributors in 19.477s

    npm verb exit [ 0, true ]

    npm timing npm Completed in 20072ms

    npm info ok

  • 相关阅读:
    SpringBoot框架中,使用过滤器进行加密解密操作(一)
    Oracle SQL Developer 连接数据库问题总结
    ios 自动布局
    iOS 跳转动画 改变pushViewController动画
    ios修饰符
    iOS 屏幕弹框
    iOS 单例类,
    Swift 阳历转农历,农历转公历
    Swift限制只能输入中文(粘贴无效),Swift限制输入字数
    swift判断 UILabel文字是否被折叠 是否有省略号 是否没显示全
  • 原文地址:https://www.cnblogs.com/ouyangxiaoyao/p/12634108.html
Copyright © 2011-2022 走看看