当前位置:网站首页>Error: eacces: permission denied, access to "/usr/lib/node_modules"
Error: eacces: permission denied, access to "/usr/lib/node_modules"
2022-07-02 13:48:00 【Big front end journey】
error :EACCES: Permission denied , visit “/usr/lib/node_modules”
I'm trying to use it today command install typescript npm install -g typescript, It returns this error :
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!
Specific error report

After reading, only
So is there a corresponding solution , The answer, of course, is yes , Next, let's look at the moves
Create a directory for the global installation :
mkdir ~/.npm-global
To configure npm To use the new directory path :
npm config set prefix '~/.npm-global'
Open or create a ~/.profile File and add the following lines :
open ~/.profile
export PATH=~/.npm-global/bin:$PATH
Back to the command line , Update system variables :
source ~/.profile
test : Without using sudo Download a package globally .
npm install -g typescript
If you are using Z shell (Zsh), Please add export PATH=~/.npm-global/bin:$PATH Into your file ~/.zshrc
Good success solves the problem .
So learning is about meeting problems , The process of solving problems , Come on, boy , Believe you can .
边栏推荐
- The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
- Dingtalk send message
- The 29 year old programmer in Shanghai was sentenced to 10 months for "deleting the database and running away" on the day of his resignation!
- I did it with two lines of code. As a result, my sister had a more ingenious way
- A better database client management tool than Navicat
- Research shows that "congenial" is more likely to become friends
- Qt如何设置固定大小
- [cloud native database] what to do when encountering slow SQL (Part 1)?
- Qt-制作一个简单的计算器-实现四则运算-将结果以对话框的形式弹出来
- Halcon extract orange (Orange)
猜你喜欢

Error function ERF

Gee learning notes 2

Node. JS accessing PostgreSQL database through ODBC

Explanation: here is your UFO, Goldbach conjecture

Web Foundation

Node.js通过ODBC访问PostgreSQL数据库

Browser driven Download

题解《子数整数》、《欢乐地跳》、《开灯》

Drawing Nyquist diagram with MATLAB

The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
随机推荐
Detailed collection of common MySQL commands
Sum of the first n terms of Fibonacci (fast power of matrix)
错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
Subcontracting configuration of uniapp applet subpackages
Download files and preview pictures
Halcon extract orange (Orange)
量子三体问题: Landau Fall
JS reverse row query data decryption
[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术
Runhe hi3516 development board openharmony small system and standard system burning
Dingtalk send message
Selenium, element operation and browser operation methods
故事点 vs. 人天
科技的成就(二十七)
题解:《压缩技术》(原版、续集版)
Achievements in science and Technology (27)
Chinese name extraction (toy code - accurate head is too small, right to play)
numpy数组计算
ArrayList and LinkedList
【模板】最长公共子序列 (【DP or 贪心】板子)