当前位置: 首页 > 知识库问答 >
问题:

npm安装不工作。说我需要检查权限?

高修筠
2023-03-14

我现在正试图在我的机器上安装eslint,但它说我需要检查权限,因为它缺少对/user/local/lib/node_模块的写访问权限。有人知道如何解决这个问题吗?谢谢

npm install -g eslint
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
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/mkaplan/.npm/_logs/2019-03-03T18_05_46_487Z-debug.log

共有3个答案

司马庆
2023-03-14

这可以解决问题:

sudo npm install -g npm
皇甫高阳
2023-03-14

对于Linux,请使用sudo npm安装,对于Windows,请以管理员身份运行powerShell,并访问项目目录并运行npm安装

南宫博简
2023-03-14

尝试sudo npm安装-g eslint

 类似资料:
  • 我用Java 8创建了一个Java应用程序。 我已将其部署到服务器,并出现以下错误: 当我运行java版本时,我得到了以下信息: 我以前没见过这个。我需要安装JRE 8吗?

  • 问题内容: 在运行之前,我需要检查是否已安装“ mocha”。我想出了以下代码: 我不喜欢这个例外。有没有更好的办法? 问题答案: 您应该使用而不是。如果找到将加载库,但不会加载,它将返回模块的文件名。 请参阅文档以了解require.resolve 如果未找到模块,则require.resolve()会引发错误,因此您必须对其进行处理。

  • 我有一个rails应用程序,我正在尝试运行测试。前一天,我成功地运行了,一切都井然有序。今天,当我运行时,我收到以下错误: 我知道这个错误意味着什么,也知道如何基于pg_hba.conf连接等解决这个错误。我已经做了一次又一次,没有任何问题。 然而,我发现真正的潜在问题是我的Postgresql已经升级到9.4,但我的应用程序需要9.3。运行会给出如下所示的输出: 作为一个相对较新的Ruby/Ra

  • 我有一个问题,这也在这里讨论:onBackPress永远不会被调用 我试图取消CountDownTimer时,按从Android手机本机返回按钮。所以我想重写onBackPmed方法,取消计时器并返回到另一个活动,但只有一次。(返回到主活动,如主页按钮)。 这是代码的一部分:

  • 上个月,我安装了node 10.16.3 LTS,因为它没有最新的npm版本,所以我使用以下官方指南对其进行了更新:https://docs.npmjs.com/try-the-lates-stable-version-of-npm(选项2): 删除了%programfiles%\nodejs\npm和%programfiles%\nodejs\npm.cmd 将'npmrc'文件从%progra