zoukankan      html  css  js  c++  java
  • npm下载权限不足问题解决

    windows系统下使用node.js在使用npm安装tyarn时报错的解决方法,

    下列方法适用大部分npm下载权限不足问题

    npm ERR! code EPERM
    npm ERR! syscall open
    npm ERR! path C:Program Files
    odejs
    pm_cache\_cacache	mp2f17465b
    npm ERR! errno -4048
    npm ERR! Error: EPERM: operation not permitted, open 'C:Program Files
    odejs
    pm_cache\_cacache	mp2f
    17465b'
    npm ERR!  [OperationalError: EPERM: operation not permitted, open 'C:Program Files
    odejs
    pm_cache\_c
    acache	mp2f17465b'] {
    npm ERR!   cause: [Error: EPERM: operation not permitted, open 'C:Program Files
    odejs
    pm_cache\_caca
    che	mp2f17465b'] {
    npm ERR!     errno: -4048,
    npm ERR!     code: 'EPERM',
    npm ERR!     syscall: 'open',
    npm ERR!     path: 'C:\Program Files\nodejs\npm_cache\_cacache\tmp\2f17465b'
    npm ERR!   },
    npm ERR!   isOperational: true,
    npm ERR!   stack: "Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\npm_cache\_
    cacache\tmp\2f17465b'",
    npm ERR!   errno: -4048,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'open',
    npm ERR!   path: 'C:\Program Files\nodejs\npm_cache\_cacache\tmp\2f17465b'
    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.
    提供几种如下解决方案
    1. 使用win+x,选择命令提示符(管理员),在里面运行命令就好了。

    2. 如果自己本身就是管理员权限,因而无用,最后症结是缓存问题导致

    需要删除npmrc文件。
    
    强调:不是nodejs安装目录npm模块下的那个npmrc文件
    
    而是在C:Users{账户}下的.npmrc文件..
    
    1. 当然也有说用命令清除缓存的,我自己试了下没成功,上面删除文件来的更加直接彻底,关键是见效。

    直接用命令清理就行,控制台输入:

    npm cache clean --force
     
  • 相关阅读:
    Windows 命令行
    建议博客园提供 BT 资源发布功能——由分享 VS2005 Beta2 的历程想到的
    成功 自信 快乐(转载)
    轻松一下,加菲猫语录
    COmega 概述
    对 RBAC 几种模型的理解及初步实现构想
    DHTML 中滚动条的设置
    求婚
    终于有了自己的blog!
    VS2005 已发布!
  • 原文地址:https://www.cnblogs.com/lixin-nobody/p/14051905.html
Copyright © 2011-2022 走看看