【发布时间】:2019-06-13 11:33:32
【问题描述】:
我正在尝试使用 npm install 从已经存在的 react 项目安装我的依赖项,但是,现在每次尝试运行 npm install 时都会给我这个错误。
有谁知道为什么现在会发生这种情况?我有几个项目在安装和卸载之前一直在做,完全没有问题。
npm WARN deprecated fsevents@2.0.6: Please update: there are crash fixes
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! path /Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732'
npm ERR! [OperationalError: EACCES: permission denied, open '/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732'] {
npm ERR! cause: [Error: EACCES: permission denied, open '/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EACCES: permission denied, open ' +
npm ERR! "'/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/Users/gabrielnessi/.npm/_cacache/index-v5/35/e4/300bcd6d6b07328b3cffb3509f86bc1ac535a870f8fe27c074a299d8c732',
npm ERR! parent: 'eslint-plugin-jsx-a11y'
npm ERR! }
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).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/gabrielnessi/.npm/_logs/2019-06-13T11_28_05_702Z-debug.log```
【问题讨论】:
-
某些依赖项需要您拥有超级用户访问权限。试试 sudo npm install
-
@MehulMittal 这是第二次发生,也是我第一次用 sudo 解决,是的,但我不想每次必须安装软件包时都使用 sudo,有没有办法获得我的权限吗?谢谢
-
你的项目的路径是什么
-
@MehulMittal Documents/react_course/react-complete-guide(在 macbook 上)
-
执行
npm cache clean或npm cache clean --force如果它不起作用,请尝试使用sudo。因为很可能您的缓存已损坏。然后安装软件包。
标签: node.js