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. Android SQLite学习指南

    一.SQLite简介 在Android平台上,集成了一个嵌入式关系型数据库—SQLite,SQLite3支持 NULL.INTEGER.REAL(浮点数字).TEXT(字符串文本)和BLOB(二进制对 ...

  2. 把自定义的decoder加入ffmpeg源码

    第一步: 在libavcodec目录下新建mkdecoder.c,并加入一下代码: /* *实现一个自己的decoder,编码工作其实就是把pkt的数据拷贝到frame *作者:缪国凯(MK) *82 ...

  3. 树套树Day2

    滚回来更新,,, 在Day1我们学了最基本的线段树套平衡树 Day2开始我们要学习一些黑科技 (所以很大概率会出现Day3 w 1.线段树上的黑科技 这一段我们分几项来讲 1.权值线段树 权值线段树以 ...

  4. 【LeetCode】080. Remove Duplicates from Sorted Array II

    题目: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For ex ...

  5. 快速排序的JavaScript实现

    思想 分治的思想,将原始数组分为较小的数组(但没有像归并排序一样将它们分隔开). 主元选择: 从数组中任意选择一项作为主元,通常为数组的第一项,即arr[i]:或数组的中间项, arr[Math.fl ...

  6. Python:collections的deque()方法

    转于:https://www.cnblogs.com/zhenwei66/p/6598996.html 博主:http://www.cnblogs.com/zhenwei66/(渐晨) python3 ...

  7. c++对象导出到lua

    转自:http://www.cnblogs.com/ringofthec/archive/2010/10/26/luabindobj.html 虽然有tolua++, luabind等等, 不过自己手 ...

  8. Weblogic反序列化漏洞(CVE-2017-10271)复现

    通过POST发送xml数据对WebLogic Server组件的WLS Security子组件造成任意代码执行漏洞 影响版本:10.3.6.0.0,12.1.3.0.0,12.2.1.1.0,12.2 ...

  9. [51nod1043]幸运号码

    题意:1个长度为2N的数,如果左边N个数的和 = 右边N个数的和,那么就是一个幸运号码. 例如:99.1230.123312是幸运号码. 给出一个N,求长度为2N的幸运号码的数量.由于数量很大,输出数 ...

  10. hadoop自动安装脚本

    还不能实现完全自动安装,只能算半自动的. 进行交互主要障碍有两点: 1. ssh-keygen的时候需要点击回车. 2. passwd 需要设置密码  如果谁能解决以上两点,欢迎email给我. 另外 ...