Error: EACCES: permission denied, access

Error: EACCES: permission denied, access

sh 复制代码
npm ERR! path /Users/apple/Documents/project/purchase-platform/AWPc/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/apple/Documents/project/purchase-platform/AWPc/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/Users/apple/Documents/project/purchase-platform/AWPc/node_modules']
npm ERR!  stack:
npm ERR!    'Error: EACCES: permission denied, access \'/Users/apple/Documents/project/purchase-platform/AWPc/node_modules\'',
npm ERR!  errno: -13,
npm ERR!  code: 'EACCES',
npm ERR!  syscall: 'access',
npm ERR!  path:
npm ERR!    '/Users/apple/Documents/project/purchase-platform/AWPc/node_modules' }
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!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

解决办法:

  1. 首先添加sudo操作。

    sh 复制代码
     sudo npm install
  2. 如果不行添加--unsafe-perm=true:

    sh 复制代码
    sudo npm install --unsafe-perm=true
  3. 或许还是报错,添加--allow-root:

    sh 复制代码
    sudo npm install --unsafe-perm=true --allow-root
相关推荐
aPurpleBerry5 分钟前
JS常用数组方法 reduce filter find forEach
javascript
ZL不懂前端43 分钟前
Content Security Policy (CSP)
前端·javascript·面试
乐闻x1 小时前
ESLint 使用教程(一):从零配置 ESLint
javascript·eslint
我血条子呢1 小时前
[Vue]防止路由重复跳转
前端·javascript·vue.js
半开半落1 小时前
nuxt3安装pinia报错500[vite-node] [ERR_LOAD_URL]问题解决
前端·javascript·vue.js·nuxt
理想不理想v2 小时前
vue经典前端面试题
前端·javascript·vue.js
小阮的学习笔记2 小时前
Vue3中使用LogicFlow实现简单流程图
javascript·vue.js·流程图
YBN娜2 小时前
Vue实现登录功能
前端·javascript·vue.js
阳光开朗大男孩 = ̄ω ̄=2 小时前
CSS——选择器、PxCook软件、盒子模型
前端·javascript·css