错误:EACCES:拒绝权限,重命名'/usr/local/lib/node_modules/expo-cli'

发布于 2025-02-13 09:04:22 字数 77 浏览 3 评论 0原文

我来了这个错误,这似乎是一个许可问题,花了我一段时间,所以我只是想分享一个我为此找到的解决方案。

如果其他解决方案?,请分享。

I came accross this error that seems to be a permission issue, took me a while so i just wanted to share a solution I found for this.

If other solutions ?, please share them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

红玫瑰 2025-02-20 09:04:23

我为此问题找到的当前解决方案是将权限更改为当前用户。

sudo chown -R $USER /usr/local/lib/node_modules

然后尝试跑步

npm install -g <dependency>

希望这对您有用。

The current solution I found for this issue is to change the permissions to the current user.

sudo chown -R $USER /usr/local/lib/node_modules

then try running

npm install -g <dependency>

Hope this works for you.

月依秋水 2025-02-20 09:04:23

我遇到了同样的问题,但是在我正在进行的项目中。

奇怪的是,我第一次运行npm i,它起作用了,但是当我再次运行时,我会遇到相同的错误。

错误的一种稍

详细

  1. 这是解决
  2. 方法

的 使用VS -CODE)

  1. 运行npm i
  2. 您会看到错误eaccess - 路径: '/users/[thepath]/[my -project]/node_modules /...
  3. 复制路径的第一部分,直到node_modules - &gt; /user/[thepath]/[my-project]
  4. 打开终端
  5. 运行sudo chown -r $ user/user/[thepath]/[my-prodject]
  6. 等待有点,由于-r ,它将递归运行,并给予
  7. 对项目中的每个文件的写入访问权限,然后运行npm i工作 ;)。

I had the same problem, but inside a project I was working on.

Curiously, the first time I ran npm i, it worked, but when I ran it again, I got the same error.

Here's a slightly more detailed method for resolving the error

Make sure npm shall run

  1. Open the terminal
  2. Run sudo chown -R $(whoami) ~/.npm

Inside your project (I'm opening it with vs-code)

  1. Run the npm i
  2. You'll see the error EACCESS - path: '/Users/[thePath]/[my-project]/node_modules/...
  3. Copy the first part of the path, till node_modules -> /Users/[thePath]/[my-project]
  4. Open a terminal
  5. Run sudo chown -R $USER /Users/[thePath]/[my-project]
  6. Wait a bit, it will run recursively due to -R and give write access to every file
  7. Inside your project, run the npm i again, this should work ;).
黄昏下泛黄的笔记 2025-02-20 09:04:23

首先,我确实

ls -la

确定了哪些文件夹不下于我的用户并运行

sudo chown -R $USER <FOLDER>

First i do

ls -la

Identify which folders not below to my user and run

sudo chown -R $USER <FOLDER>
伤感在游骋 2025-02-20 09:04:23

对我来说是;
sudo chown -r“ user/mac/.npm”
进而;
NPM缓存清洁 - 力

for me it was;
sudo chown -R "User/mac/.npm"
and then;
npm cache clean --force

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文