错误:EACCES,甚至在使用sudo之后拒绝了权限? [英] Error: EACCES, permission denied even after using sudo?

查看:278
本文介绍了错误:EACCES,甚至在使用sudo之后拒绝了权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个Chrome扩展程序,该扩展程序将自动保存使用检查元素功能对我的网站所做的更改。这个想法是,你将能够对网站进行实时更改,而不必回到IDE来保存更改并重新上传等等。该扩展名称为DevTools Autosave。我一直在按照这个网站的指示。我试图在Mac上安装它。



我已经安装了node.js和扩展。当我到达指令中涉及在终端中运行哪些命令的部分时,我尝试了在npm install -g autosave命令之前使用和不使用sudo命令,但是我总是得到此错误:

 错误:EACCES,权限在Function.startup.resolveArgv0(node.js:815:23)处被拒绝

在启动时(node.js:58:13)
在node.js:906:3

npm ERR! autosave@1.0.3 install:`node。/ scripts / install.js`
npm ERR!退出状态8
npm ERR!
npm ERR! autosave@1.3.3安装脚本失败。
npm ERR!这很可能是自动保存包
npm ERR!的问题!而不是npm本身。
npm ERR!告诉作者这在你的系统上失败了:
npm ERR!节点./scripts/install.js
npm ERR!您可以通过以下方式获得他们的信息:
npm ERR! npm所有者ls自动保存
npm ERR!上面可能还有其他日志记录输出。
npm ERR!系统Darwin 14.0.0
npm ERR!命令node/ usr / local / bin / npminstall-gautosave
npm ERR! cwd / Users / Brent
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR!代码ELIFECYCLE
npm ERR!不好的代码0

任何人都知道我可以如何解决这个问题?我找不到任何人有这个问题,我现在已经在几个不同的论坛,但无法找到解决方案。

解决方案

您有两种选择:修复您的 npm setup,所以你可以使用 npm -g ,或者在本地安装 autosave



要在本地安装(即在当前目录中的 node_modules 中),运行 npm install autosave (没有 -g )。然后,您可以运行 ./ node_modules / .bin / autosave ./ node_modules / autosave / bin / autosave 开始 autosave



要解决您的 npm 你可以在没有root权限的情况下使用 -g (推荐):

在你的home dir中(假设 / Users / Brent / ),创建一个名为 .npmrc 的文件,其中包含以下内容:

  cache = /Users/Brent/.npm/cache 
globalconfig = /Users/Brent/.npm/npmrc
globalignorefile = / Users / Brent /.npm/npmignore
prefix = /Users/Brent/.npm

然后添加〜/ .npm / lib / node_modules 添加到您的 NODE_PATH 中,例如通过在 .bashrc (假设你的shell是bash)中放置以下代码以允许找到模块,并追加〜/ .npm / bin PATH ,所以你可以运行任何已安装的二进制文件(即从任何地方运行 autosave`):

export NODE_PATH = $ HOME / .npm / lib / node_modules
export PATH = $ PATH:$ HOME / .npm / bin

(对 .bashrc 的更改仅在您生效时生效加载shell或使用。〜/ .bashrc ;如果你想在不重新加载shell的情况下使用新的设置,只需运行该行( export ... )在您当前的shell中)。


I am trying to set up a chrome extension that will automatically save the changes I make to my website with the inspect element feature. The idea is that you'll be able to make real time changes to the website without having to go back into the ide to save the changes and re-upload and everything. The extension is called DevTools Autosave. I've been following the instructions from this site. I'm trying to install this on a mac.

I've installed node.js and the extension already. When I got to the part in the instructions where it talks about which commands to run in the terminal I've tried both with and without the "sudo" in front of the "npm install -g autosave" command but I always get this error:

Error: EACCES, permission denied
    at Function.startup.resolveArgv0 (node.js:815:23)
    at startup (node.js:58:13)
    at node.js:906:3

npm ERR! autosave@1.0.3 install: `node ./scripts/install.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the autosave@1.0.3 install script.
npm ERR! This is most likely a problem with the autosave package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./scripts/install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls autosave
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "autosave"
npm ERR! cwd /Users/Brent
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Anyone know how I can fix this? I can't find anyone that is having this problem and I've been on a few different forums now but can't find a solution. Thanks in advance.

解决方案

You have two options: Either fix your npm setup, so you can use npm -g, or install autosave locally.

To install locally (i.e. in node_modules within your current directory), run npm install autosave (without -g). Then you can run ./node_modules/.bin/autosave or ./node_modules/autosave/bin/autosave to start autosave.

To fix your npm setup, so you can use -g without root permissions (recommended):

In your home dir (assuming /Users/Brent/), create a file called .npmrc with the following content:

cache = /Users/Brent/.npm/cache
globalconfig = /Users/Brent/.npm/npmrc
globalignorefile = /Users/Brent/.npm/npmignore
prefix = /Users/Brent/.npm

And add ~/.npm/lib/node_modules to your NODE_PATH, e.g. by putting the following in .bashrc (assuming that your shell is bash) to allow the modules to be found, and append ~/.npm/bintoPATHso you can run any installed binary (i.e. runautosave` from anywhere):

export NODE_PATH=$HOME/.npm/lib/node_modules
export PATH=$PATH:$HOME/.npm/bin

(changes to .bashrc only take effect when you load the shell, or use . ~/.bashrc; if you want to use the new setup without reloading the shell, just run that line (export ...) in your current shell).

这篇关于错误:EACCES,甚至在使用sudo之后拒绝了权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆