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

“npm安装-g npm@latest”损坏了我的npm安装-Windows 8.1

凤衡
2023-03-14

上个月,我安装了node 10.16.3 LTS,因为它没有最新的npm版本,所以我使用以下官方指南对其进行了更新:https://docs.npmjs.com/try-the-lates-stable-version-of-npm(选项2):

  1. 删除了%programfiles%\nodejs\npm和%programfiles%\nodejs\npm.cmd
  2. 将'npmrc'文件从%programfiles%\nodejs\node_modules\npm移动到%appdata%\npm\nde_modules\npm
C:\Users\Wladyslaw\AppData\Roaming\npm\npx -> C:\Users\Wladyslaw\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\Wladyslaw\AppData\Roaming\npm\npm
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Wladyslaw\AppData\Roaming\npm\npm'
npm ERR!  { [Error: EPERM: operation not permitted, open 'C:\Users\Wladyslaw\AppData\Roaming\npm\npm']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, open 'C:\Users\Wladyslaw\AppData\Roaming\npm\npm'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'open',
npm ERR!      path: 'C:\\Users\\Wladyslaw\\AppData\\Roaming\\npm\\npm' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, open \'C:\\Users\\Wladyslaw\\AppData\\Roaming\\npm\\npm\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Users\\Wladyslaw\\AppData\\Roaming\\npm\\npm' }
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Wladyslaw\AppData\Roaming\npm-cache\_logs\2019-10-17T19_35_58_442Z-debug.log
bash: /c/Users/Wladyslaw/AppData/Roaming/npm/npm: No such file or directory


有什么方法可以在不重新安装整个Node.js的情况下修复这样损坏的npm安装吗?
谢谢

共有1个答案

白阳煦
2023-03-14

您刚刚以管理员身份运行命令行

 类似资料:
  • 问题内容: 当我尝试使用npm时,我刚刚安装了node ,但始终收到以下错误: 我尝试这样做,但是它无法更新自身,只是不断在上面抛出相同的错误。 当我运行它时,似乎是最新版本。 我尝试删除该文件夹并在node.js安装程序上运行修复功能,但未替换该模块。 问题答案: 删除全局NPM文件夹 https://stackoverflow.com/a/5926706/349659 对于Windows,这很

  • 我是cypress的新手,我想知道vsI在谷歌上搜索了一下,但没有找到任何答案

  • 在用 Vue 构建大型应用时推荐使用 NPM 安装。NPM 能很好地和诸如webpack或Browserify模块打包器配合使用。同时 Vue 也提供配套工具来开发单文件组件。 # 最新稳定版 $ npm install vue 对于中国大陆用户,建议将 NPM 源设置为国内的镜像,可以大幅提升安装速度。

  • 问题内容: 我最近在ubuntu 64位上安装了nodejs版本0.10.26。node -v和npm -v命令运行正常,我可以看到正确的版本。当我做一个安装顺利。但是当我尝试用express创建项目时,出现错误提示 当前未安装程序“ express”。您可以通过键入以下命令进行安装:sudo apt-get install node-express 我必须在$ PATH中包含一些路径才能运行ex

  • 任何帮助都将得到高度赞赏。 谢谢,沙兹

  • 我正在运行npm来安装mnodesql,这是一个用于sql服务器驱动程序的npm库。我安装这个Windows Server 2012盒。 我已经安装了Visual C 2010、node gyp和Python 2.7.x.x作为依赖项,所有这些安装都是成功的。 当我运行npm install msnodesql时,我得到一个红色的大错误: (x86)\MSBuild\Microsoft.Cpp\v