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
相关推荐
纯粹的摆烂狗3 分钟前
深圳大学-智能网络与计算-实验四:云-边协同计算实验
javascript
binnnngo6 分钟前
2.体验vue
前端·javascript·vue.js
LCG元7 分钟前
Vue.js组件开发-实现多个文件附件压缩下载
前端·javascript·vue.js
yqcoder38 分钟前
Commander 一款命令行自定义命令依赖
前端·javascript·arcgis·node.js
前端Hardy1 小时前
HTML&CSS :下雪了
前端·javascript·css·html·交互
码上飞扬2 小时前
Vue 3 30天精进之旅:Day 05 - 事件处理
前端·javascript·vue.js
程序员小寒2 小时前
由于请求的竞态问题,前端仔喜提了一个bug
前端·javascript·bug
赵不困888(合作私信)3 小时前
npx和npm 和pnpm的区别
前端·npm·node.js
python算法(魔法师版)7 小时前
React应用深度优化与调试实战指南
开发语言·前端·javascript·react.js·ecmascript
阿芯爱编程10 小时前
vue3 vue2区别
前端·javascript·vue.js