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
總結
以上是生活随笔為你收集整理的Mac电脑使用:通过Mac终端安装淘宝镜像报错,提示无权限的解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: One Order distributi
- 下一篇: 如何使用代码给product创建dist