如何修复弹出错误权限被拒绝?
日志:
50 silly saveTree +-- lens-survey@5.2.5-latest.20211001.2
50 silly saveTree +-- lens-telemetry@5.2.5-latest.20211001.2
50 silly saveTree `-- lenscloud-lens-extension@5.2.5-latest.20211001.2
51 warn Lens No description
52 warn Lens No repository field.
53 warn Lens No license field.
54 verbose stack Error: EACCES: permission denied, access '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'
55 verbose cwd /Users/162408.suryadi/Library/Application Support/Lens
56 verbose Darwin 20.4.0
57 verbose argv "/Applications/Lens.app/Contents/Frameworks/Lens Helper.app/Contents/MacOS/Lens Helper" "/Applications/Lens.app/Contents/Resources/app.asar/node_modules/npm/bin/npm-cli.js" "install" "--no-audit" "--only=prod" "--prefer-offline" "--no-package-lock"
58 verbose node v14.16.0
59 verbose npm v6.14.13
60 error code EACCES
61 error syscall access
62 error path /Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension
63 error errno -13
64 error Error: EACCES: permission denied, access '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'
64 error [Error: EACCES: permission denied, access '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'] {
64 error errno: -13,
64 error code: 'EACCES',
Could not load extensions: npm WARN checkPermissions Missing write access to /Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension
npm WARN enoent ENOENT: no such file or directory, open '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/untitled folder/package.json'
npm WARN Lens No description
npm WARN Lens No repository field.
npm WARN Lens No license field.
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'
npm ERR! [Error: EACCES: permission denied, access '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension'
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/162408.suryadi/.npm/_logs/2021-10-21T02_16_36_016Z-debug.log
您可以在日志中找到问题的描述:
您可能没有当前用户访问该文件的权限。
还有一件事要检查:
如果您认为这可能是权限问题,请仔细检查文件及其包含目录的权限,或者尝试以root/Administrator身份再次运行该命令。
您得到的错误是因为您无法从当前用户访问资源/Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension
。如果要修复它,必须更改此资源的权限或更改其所有者。也有可能(因为你使用的是Kubernetes),你必须在你正在使用的系统映像中进行这样的更改。
要更改资源的所有者,运行
sudo chown -R $USER /Users/162408.suryadi/Library/Application Support/Lens/node_modules/lenscloud-lens-extension
你也可以发现许多类似的问题。在大多数情况下,唯一的区别是到资源的路径不同。操作方式和问题的解决方法保持不变:
- 错误:EACCES: permission denied, access '/usr/local/lib/node_modules'
- npm WARN checkPermissions缺少对/usr/local/lib/node_modules的写访问权限
- https://progressivecoder.com/how-to-easily-fix-missing-write-access-error-npm-install/
- https://flaviocopes.com/npm-fix-missing-write-access-error/