gpt4 book ai didi

node.js - 使用 npm 安装某物时出现错误 : EACCES: permission denied, mkdir

转载 作者:太空宇宙 更新时间:2023-11-03 22:57:42 26 4
gpt4 key购买 nike

每次我尝试使用 npm (在本例中为 electro-packager)安装某些东西时,我都会遇到此错误。我该如何解决这个问题?

我已经尝试通过 chmod 更改 .npm 的权限来授予我访问权限,但它不起作用,我还尝试使用另一个 Node 版本(通过 nvm 安装:node -v 12.1.0; npm - v 6.9.0)但效果不佳。

$ npm install electron-packager --save-dev
npm ERR! path /Users/felixmoser/.npm/_cacache/index-v5/15/a0
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR! [OperationalError: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR! cause: [Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EACCES: permission denied, mkdir ' +
npm ERR! "'/Users/felixmoser/.npm/_cacache/index-v5/15/a0'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0',
npm ERR! parent: 'electron-packager'
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/felixmoser/.npm/_logs/2019-05-01T14_11_08_530Z-debug.log

我实际上不知道现在还应该尝试什么,希望你们能帮我解决这个问题!

最佳答案

更改.npm文件夹的所有权,就我而言,我无法找出解决方案,所以我使用了

sudo chown -R $(whoami) ~/.npm

关于node.js - 使用 npm 安装某物时出现错误 : EACCES: permission denied, mkdir,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55938030/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com