解决mac系统中npm全局安装提示没有权限的问题

摘要:
[错误:EACES:访问“/usr/local/lib/node_modules”]{npmERR!错误:代码:路径:“/usr/local/lb/node_mdules”npmERROR!修改用户权限sudocown-R$(whoami)$(npmconfiggetprefix)/{lib/node_modules,

当使用npm或者cnpm安装全局模块时,提示报错信息:

LDX@admin88 ~ % npm install --global nodemon
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!   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.

  解决方法:  修改用户权限

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

  重新使用npm安装全局模块就可以了

LDX@admin88 express % nodemon app.js              
[nodemon] 2.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
app is running at port 3001

  

 

免责声明:文章转载自《解决mac系统中npm全局安装提示没有权限的问题》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Hadoop基础-HDFS数据清理过程之校验过程代码分析基于openEuler的OpenSSL编译安装和编程基础下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

craco 配置 less.module

const CracoLess = require('craco-less') const CracoAntDesign = require('craco-antd') const path = require('path') module.exports = { plugins: [ // 针对Less的相关配置(如module...

vue 插件之install

问题:学习自定义指令时候,在directive/index.js中有这样一段代码: import copy from "./copy"; export default { install(Vue) { Vue.directive('copy', copy); }, }; 详见:vue自定义指令封装(加深印象) 几天后,看到一个帖子组...

利用jenkins插件查看allure报告

背景:1.不在服务器上运行测试脚本,单纯地利用jenkins中的allure插件查看测试报告; 参考链接:如何利用jenkins插件查看allure报告-----完整篇(解决404和无数据问题) - 青域 - 博客园 (cnblogs.com) 1.打开jenkins--插件管理--可选插件,搜索安装最新版allure; 2.下载allure-comman...

全局消息钩子

钩子(Hook),是Windows消息处理机制的一个平台,应用程序可以在上面设置子程以监视指定窗口的某种消息,而且所监视的窗口可以是其他进程所创建的。当消息到达后,在目标窗口处理函数之前处理它。钩子机制允许应用程序截获处理window消息或特定事件。钩子实际上是一个处理消息的程序段,通过系统调用,把它挂入系统。每当特定的消息发出,在没有到达目的窗口前,钩子程...

软件质量属性——安全性

安全性的定义: 指软件系统同时兼顾向合法用户提供服务,以及阻止非授权使用的能力; 安全性面对的攻击方式: 未经授权试图访问数据或服务。 未经授权试图修改数据。 试图使用系统拒绝向合法用户提供的服务。 安全性的特点: 通过软件执行才可见的质量因素; 安全性的需求: 对有保密性要求的数据实施安全控制; 提供系统运行日志监控信息,供管理员了解系统运行状态; 安全...

Element中的Cascader 级联选择器高度不能正常显示如何解决2

新版本的element在使用级联选择器的时候,高度存在问题,如何解决呢,之前的旧版本 可以通过自定义属性popper-class解决,但是新版本的无法使用这个属性解决了,新版本的问题必须在全局的global.css中更改 具体的更改方法如下: 在你的全局global.css里面添加: .el-cascader-menu { height: 300px;...