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

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§

Note: This section does not apply to Microsoft Windows.

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.

  1. Back up your computer.
  2. On the command line, in your home directory, create a directory for global installations:
     mkdir ~/.npm-global
  3. Configure npm to use the new directory path:
     npm config set prefix '~/.npm-global'
  4. In your preferred text editor, open or create a ~/.profile file and add this line:
     export PATH=~/.npm-global/bin:$PATH
  5. On the command line, update your system variables:
     source ~/.profile
  6. 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
npx: an alternative to running global commands

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 权限问题的更多相关文章

  1. npm install权限问题,报错:permission denied。

    1.部署gulp项目时,nodeJs和gulp都已经正确安装,在项目内部执行npm install命令时,有些gulp的插件一直下载不成功,报错几种以下错误: “gulp-imagemin: Coul ...

  2. npm install 权限的问题

    用ctrl+r切换到对象的目录,以管理圆的身份执行 npm cache clean first. If that doesn’t fix things, take a look in %APPDATA ...

  3. npm install -g 全局安装总是出现permission权限问题的解决方案

    npm install -g 全局安装总是出现permission权限问题的解决方案 开始使用node的时候,在使用npm安装global packages时,习惯性地使用npm install -g ...

  4. npm install 提示权限不足 Error: EPERM: operation not permitted, unlink XXX

    问题 使用npm install时提示权限不足 原因 这里原因有两个: 没有管理员权限访问C盘下npm路径导致下载失败. NPM官网没有下载权限. 解决方案 第一原因 这里可以使用管理员身份执行以下命 ...

  5. 【vue iview】项目 win10 放在C盘 经常npm install不成功,就是因为 权限问题,把代码目录放到D盘就没事了。

    [vue iview]项目 win10 放在C盘 经常npm install不成功,就是因为 权限问题,把代码目录放到D盘就没事了.

  6. Mac环境下执行npm install报权限错误解决办法

    1. 一般情况 sudo npm install 注:这相当于windows系统中的 以管理员身份执行,加上sudo后会要求你输入苹果账号密码,而且在输入的时候是没有字符提示的,密码输入完直接按回车就 ...

  7. NPM install - killed error solution

    在接手一个Node项目的时候,npm install.却出现了"killed"的错误.以为是Node版本的问题,熟练地切换了0.11与0.10版,同样无解. 由于新的npm版本吧, ...

  8. window环境下npm install node-sass报错

    最近准备想用vue-cli初始化一个项目,需要sass-loader编译: 发现window下npm install node-sass和sass-loader一直报错, window 命令行中提示我 ...

  9. 使用npm install报错-4048 operation not permitted解决

    刚刚使用npm install时一直报错-4048 operation not permitted,也尝试了多种方法,终于使问题得到解决,这里总结几种方法,先贴图: 一:权限问题 首先看到operat ...

随机推荐

  1. 【IPC通信】key_t键和ftok函数

    System V IPC分为三种: System V消息队列 System V信号量 System V共享内存区 这三种类型的IPC使用key_t值做为它们的名字. key_t这个数据类型在<s ...

  2. 用nginx搭建http/rtmp/hls协议的MP4/FLV流媒体服务器

    前前后后搭建了两三个星期,终于可以告一段落,nginx实在是有点强大.写一篇笔记来记录一下这个过程中的思路和解决方案. 一.搭建nginx平台: 基本是基于http://blog.csdn.net/x ...

  3. Arc065_E Manhattan Compass

    平面上有$N$个点$(X_i\space, Y_i)$,定义$D(a,b)=|X_a-X_b|+|Y_a-Y_b|$. 如果你当前在$(p,q)$,这个无序二元组(即$(p,q)$和$(q,p)$被认 ...

  4. TYVJ P1728 普通平衡树

    P1728 普通平衡树 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 此为平衡树系列第一道:普通平衡树 描述 您需要写一种数据结构(可参考题目标题),来维护 ...

  5. 接口Comparator和Comparable的区别和联系

    1. Comparator 和 Comparable 相同的地方 他们都是java的一个接口, 并且是用来对自定义的class比较大小的. 什么是自定义class: 如 public class Pe ...

  6. JVM类加载(4)—加载器

    定义: 虚拟机设计团队把类加载阶段中“通过一个类的全限定名来获取描述此类的二进制字节流”这个动作放到虚拟机外部去实现,以便让应用程序自己决定如何去获取所需要的类.实现这个动作的代码模块称之为“类加载器 ...

  7. net start sql server (instance)

    如何启动 SQL Server 实例(net 命令) 其他版本   可以使用 Microsoft Windows net 命令启动 Microsoft SQL Server 服务. 启动 SQL Se ...

  8. Pycharm的远程代码编辑

    作为一个从java转到python的程序猿,一直觉得python的远程代码调试能力不如java,远程调试一把需要各种改代码,牵扯到eventlet库的时候,问题就更严重,需要调整eventlet的各种 ...

  9. Java学习路线-知乎

    鼬自来晓 378 人赞同 可以从几方面来看Java:JVM Java JVM:内存结构和相关参数含义 · Issue #24 · pzxwhc/MineKnowContainer · GitHub J ...

  10. Java探索之旅(7)——对象的思考

    1.知识要点 ❶不可变类:一旦创建,其内容不能改变的类称之为不可变类.满足:⑴所有数据域私有,⑵没有修改器,⑶没有访问器方法,其返回一个指向可变数据域的引用.(这样通过引用就能修改私有数据域).比如, ...