当前位置:网站首页>错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
2022-07-02 10:17:00 【大前端之旅】
错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
今天我在尝试使用 command 安装 typescript npm install -g typescript,它返回此错误:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/n
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/n'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/n'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/n'
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!
具体报错

看完只有
那么有没有对应的解决办法呢,答案当然是有的,接下来看招
为全局安装创建一个目录:
mkdir ~/.npm-global
配置 npm 以使用新的目录路径:
npm config set prefix '~/.npm-global'
打开或创建一个 ~/.profile 文件并添加以下行:
open ~/.profile
export PATH=~/.npm-global/bin:$PATH
返回命令行,更新系统变量:
source ~/.profile
测试:在不使用 sudo 的情况下全局下载一个包。
npm install -g typescript
如果您使用的是 Z shell (Zsh),请添加export PATH=~/.npm-global/bin:$PATH到您的文件中~/.zshrc
好的成功解决了问题。
所以说学习就是遇到问题,解决问题的过程,少年加油吧,相信你可以的。
边栏推荐
- 记忆函数的性能优化
- Professor of Shanghai Jiaotong University: he Yuanjun - bounding box (containment / bounding box)
- 伙伴云表格强势升级!Pro版,更非凡!
- P3807 [template] Lucas theorem /lucas theorem
- 运维必备——ELK日志分析系统
- [unity] using GB2312, the solution to abnormal program after packaging
- Redis database persistence
- rxjs Observable 自定义 Operator 的开发技巧
- Drawing Nyquist diagram with MATLAB
- (POJ - 1308)Is It A Tree? (tree)
猜你喜欢

OpenApi-Generator:简化RESTful API开发流程

Three methods of finding LCA of the nearest common ancestor

Runhe hi3516 development board openharmony small system and standard system burning

OpenFOAM:lduMatrix&lduAddressing
![[cloud native database] what to do when encountering slow SQL (Part 1)?](/img/ac/a59189aba1901e769beec1ec7e6d32.png)
[cloud native database] what to do when encountering slow SQL (Part 1)?

Essential for operation and maintenance - Elk log analysis system

2022 Heilongjiang provincial examination on the writing skills of Application Essays

Research shows that "congenial" is more likely to become friends

OpenFOAM:lduMatrix&lduAddressing

中文姓名提取(玩具代码——准头太小,权当玩闹)
随机推荐
OpenFOAM:lduMatrix&lduAddressing
研究表明“气味相投”更易成为朋友
linux下清理系统缓存并释放内存
Why can't d link DLL
运维必备——ELK日志分析系统
Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm
Don't spend money, spend an hour to build your own blog website
Halcon extract orange (Orange)
Unity skframework framework (XXI), texture filter map resource filtering tool
每日一题:1175.质数排列
D如何检查null
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
【youcans 的图像处理学习课】总目录
【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
D为何链接不了dll
Unity skframework framework (XX), VFX lab special effects library
P3807 [template] Lucas theorem /lucas theorem
Redis database persistence
Answer: can the audio be set to on by default during easydss video on demand?
Drawing Nyquist diagram with MATLAB