代码之家  ›  专栏  ›  技术社区  ›  Atharv Pethkar

安装npm程序包时出现权限错误

  •  0
  • Atharv Pethkar  · 技术社区  · 2 年前
    npm ERR! code EPERM
    npm ERR! syscall mkdir
    npm ERR! path H:\
    npm ERR! errno -4048
    npm ERR! Error: EPERM: operation not permitted, mkdir 'H:\'
    npm ERR!  [Error: EPERM: operation not permitted, mkdir 'H:\'] {
    npm ERR!   errno: -4048,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'mkdir',
    npm ERR!   path: 'H:\\'
    npm ERR! }
    npm ERR!
    npm ERR! The operation was rejected by your operating system.
    npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
    npm ERR! or that you lack permissions to access it.
    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.`
    

    我在尝试制作下一个项目并安装express时遇到此错误,请帮助我

    0 回复  |  直到 2 年前
        1
  •  0
  •   Echo    2 年前

    看起来你只需要以超级用户的身份运行命令,比如说如果你的命令 npm install 您可以在终端中键入此命令

    sudo npm install
    

    注意如何添加 sudo 到命令的前面,告诉计算机使用额外的权限运行此操作。

    你可以通过阅读 Wikipedia page