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. OpenCV——饱和度调整

    参考: 闲人阿发伯的博客 // define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED ...

  2. hdu Digital Square(广搜)

    题目:给出n,求出最小的m,满足m^2  % 10^k = n,其中k=0,1,2 http://acm.hdu.edu.cn/showproblem.php?pid=4394 只要有一个x满足条件便 ...

  3. HDU5768Lucky7(中国剩余定理+容斥定理)(区间个数统计)

    When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortun ...

  4. NYOJ-括号配对问题--------待解决,RE

    描述 现在,有一行括号序列,请你检查这行括号是否配对.   输入 第一行输入一个数N(0<N<=100),表示有N组测试数据.后面的N行输入多组输入数据,每组输入数据都是一个字符串S(S的 ...

  5. 多级联动下拉菜单--cxSelect

    jquery cxSelect插件 github地址:https://github.com/ciaoca/cxSelect demo地址:http://code.ciaoca.com/jquery/c ...

  6. BZOJ2733:[HNOI2012]永无乡

    浅谈线段树合并:https://www.cnblogs.com/AKMer/p/10251001.html 题目传送门:https://lydsy.com/JudgeOnline/problem.ph ...

  7. ansible的使用

    ansible主要分为单条命令和组命令(即配置后缀为名yml的文件,使用ansible-playbook执行)的使用,以下分别对两者进行说明.如不会安装ansible,请参考我的文章 centos7安 ...

  8. ipcs、ipcrm命令

    进程间通信概述进程间通信有如下的目的:1.数据传输,一个进程需要将它的数据发送给另一个进程,发送的数据量在一个字节到几M之间:2.共享数据,多个进程想要操作共享数据,一个进程对数据的修改,其他进程应该 ...

  9. ORA-12504:tns:监听程序在 CONNECT_DATA中未获得SERVICE_NAME

    在VS2008中创建一个数据源时,提示以下错误 “ORA-12504:tns:监听程序在 CONNECT_DATA中未获得SERVICE_NAME” 本机安装ORACLE客户端,找出以下路径的文件D: ...

  10. ARC097C K-th Substring

    传送门 题目 You are given a string s. Among the different substrings of s, print the K-th lexicographical ...