首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在安装终端包包时修复权限错误

如何在安装终端包包时修复权限错误
EN

Stack Overflow用户
提问于 2019-04-23 13:28:32
回答 1查看 3.1K关注 0票数 5

在nodeJS中安装包裹模块时,通过Mac上的终端,我得到了权限错误。错误: checkPermission缺少对/usr/local/lib/node_模块的写访问

我是学习节点模块的新手。我试着安装(Node,NPM),一切都很完美。但第一次安装节点模块时,它抛出错误。我知道它在寻找Windows类型URL的目录,但我不知道如何为mac修复它。

代码语言:javascript
运行
复制
iMac:~ hassan$ node -v
v11.10.0 
iMac:~ hassan$ npm -v
6.7.0
iMac:~ hassan$ npm install -g parcel-bundler
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/hassan/.npm/_logs/2019-04-23T13_13_46_848Z-debug.log

我想在我的网站上安装Ui动画软件包。

EN

回答 1

Stack Overflow用户

发布于 2019-04-23 15:05:16

您需要像超级管理员一样访问/usr/local/lib/node_modules,以执行parcel-bundler的全局安装。

正如评论中提到的,假设您的用户是这台计算机的sudoers列表,您可以简单地这样做:

代码语言:javascript
运行
复制
sudo npm -g install parcel-bundler

如果不是这样的话,您将需要系统上更多的权限来安装Parcel。然后你就可以:

  • 在文件sudoers.d中将用户添加为sudoers (请小心!)请参阅OSX的本教程 )。
  • 作为计算机的超级管理员直接执行操作.

我更喜欢关于计算机本身的长期管理和安全的第一种选择。另一种选择虽然不建议,但在某些情况下仍然是可能的。

否则,如果选择在本地安装Parcel,则不会出现权限错误。在本例中,只需在运行命令时省略-g标志(即npm install parcel-bundler)。它最终将添加包裹到您的package.json文件,以便您能够再次安装它以后。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55812369

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档