npm install 权限问题
npm ERR! Error: EACCES: permission denied, access '/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk'
npm ERR! { Error: EACCES: permission denied, access '/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk\'',
npm ERR! errno: -,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/Lobin/w
解决方案:官方链接
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Resolving EACCES permissions errors when installing packages globally
If you see an EACCES
error when you try to install a package globally, you can either:
- Reinstall npm with a node version manager (recommended),
or
- Manually change npm’s default directory
Reinstall npm with a node version manager§
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in “Downloading and installing Node.js and npm”. You do not need to remove your current version of npm or Node.js before installing a node version manager.
Manually change npm’s default directory§
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.
- Back up your computer.
- On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
- Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
- In your preferred text editor, open or create a
~/.profile
file and add this line:export PATH=~/.npm-global/bin:$PATH
- On the command line, update your system variables:
source ~/.profile
- To test your new configuration, install a package globally without using
sudo
:npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don’t want to modify ~/.profile
):
NPM_CONFIG_PREFIX=~/.npm-global
If you are using npm version 5.2 or greater, you may want to consider npx as an alternative way to run global commands, especially if you only need a command occasionally. For more information, see this article about npx.
The current stable version of npm is here. To upgrade, run: npm install npm@latest -g
To report bugs or submit feature requests for the docs, please post here. Submit npm issues here.
npm install 权限问题的更多相关文章
- npm install权限问题,报错:permission denied。
1.部署gulp项目时,nodeJs和gulp都已经正确安装,在项目内部执行npm install命令时,有些gulp的插件一直下载不成功,报错几种以下错误: “gulp-imagemin: Coul ...
- npm install 权限的问题
用ctrl+r切换到对象的目录,以管理圆的身份执行 npm cache clean first. If that doesn’t fix things, take a look in %APPDATA ...
- npm install -g 全局安装总是出现permission权限问题的解决方案
npm install -g 全局安装总是出现permission权限问题的解决方案 开始使用node的时候,在使用npm安装global packages时,习惯性地使用npm install -g ...
- npm install 提示权限不足 Error: EPERM: operation not permitted, unlink XXX
问题 使用npm install时提示权限不足 原因 这里原因有两个: 没有管理员权限访问C盘下npm路径导致下载失败. NPM官网没有下载权限. 解决方案 第一原因 这里可以使用管理员身份执行以下命 ...
- 【vue iview】项目 win10 放在C盘 经常npm install不成功,就是因为 权限问题,把代码目录放到D盘就没事了。
[vue iview]项目 win10 放在C盘 经常npm install不成功,就是因为 权限问题,把代码目录放到D盘就没事了.
- Mac环境下执行npm install报权限错误解决办法
1. 一般情况 sudo npm install 注:这相当于windows系统中的 以管理员身份执行,加上sudo后会要求你输入苹果账号密码,而且在输入的时候是没有字符提示的,密码输入完直接按回车就 ...
- NPM install - killed error solution
在接手一个Node项目的时候,npm install.却出现了"killed"的错误.以为是Node版本的问题,熟练地切换了0.11与0.10版,同样无解. 由于新的npm版本吧, ...
- window环境下npm install node-sass报错
最近准备想用vue-cli初始化一个项目,需要sass-loader编译: 发现window下npm install node-sass和sass-loader一直报错, window 命令行中提示我 ...
- 使用npm install报错-4048 operation not permitted解决
刚刚使用npm install时一直报错-4048 operation not permitted,也尝试了多种方法,终于使问题得到解决,这里总结几种方法,先贴图: 一:权限问题 首先看到operat ...
随机推荐
- Struts2 - 运行流程分析
1. 请求发送给 StrutsPrepareAndExecuteFilter 2. StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 St ...
- 机器学习 Logistic Regression
Logistic Regression 之前我们讨论过回归问题,并且讨论了线性回归模型.现在我们来看看分类问题,分类问题与回归问题类似,只不过输出变量一个是离散的,一个是连续的.我们先关注二分类问题, ...
- 幻想乡三连B:连在一起的幻想乡
$G[k][x]$表示所有$x$个点的无向图中每一个图的边数的$k$次方之和. $F[k][x]$就是在$G[k][x]$的基础上加了一个整体连通的性质. 有一个经典的套路就是对于$F$在对应的$G$ ...
- TYVJ P1728 普通平衡树
P1728 普通平衡树 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 此为平衡树系列第一道:普通平衡树 描述 您需要写一种数据结构(可参考题目标题),来维护 ...
- Gym 101142G : Gangsters in Central City(DFS序+LCA+set)
题意:现在有一棵树,1号节点是水源,叶子节点是村庄,现在有些怪兽会占领一些村庄(即只占领叶子节点),现在要割去一些边,使得怪兽到不了水源.给出怪兽占领和离开的情况,现在要割每次回答最小的割,使得怪兽不 ...
- bzoj 3533: [Sdoi2014]向量集 线段树维护凸包
题目大意: http://www.lydsy.com/JudgeOnline/problem.php?id=3533 题解: 首先我们把这些向量都平移到原点.这样我们就发现: 对于每次询问所得到的an ...
- 强烈建议使用国外DNS解析域名,解决访问速度和某些访问故障!
域名解析的基本原理是把域名翻译成IP地址,以便计算机能够进一步通信,传递网址和内容等. 域名劫持就是在劫持的网络范围内拦截域名解析的请求,分析请求的域名,把审查范围以外的请求放行,否则直接返回假的IP ...
- 洛谷【P1303】A*B Problem
题目传送门:https://www.luogu.org/problemnew/show/P1303 高精度乘法板子题,灵性地回忆一下小学时期列竖式的草稿纸即可. 时间复杂度:\(O(len^2)\) ...
- 通用RowMapper封装查询结果到自定义类中
package object; import java.lang.reflect.Field;import java.sql.ResultSet;import java.sql.SQLExceptio ...
- ES6学习之Reflect
Reflect对象与Proxy对象一样,也是 ES6 为了操作对象而提供的新 API Reflect设计目的: 将Object对象的一些明显属于语言内部的方法(比如Object.definePrope ...