首页 > 解决方案 > npm 安装错误;npm WARN tar EPERM: operation not allowed, futime

问题描述

菜鸟在这里,我正在尝试使用 bash 终端来安装 npm 模块并用作 Remote-WSL 终端。

一些背景信息,我使用 VSCode 作为我的代码编辑器。我正在尝试使用 node.js 制作一个 JavaScript 应用程序。我在 Windows 10 上设置了 Ubuntu 终端。

将 npm 更新到最新版本后,我在尝试安装 express 时开始收到这些错误,使用npm install express --save

npm WARN tar EPERM: operation not permitted, futime
npm WARN tar EPERM: operation not permitted, futime
npm WARN tar EPERM: operation not permitted, futime
// etc, etc, etc 500x...

npm WARN bashdemo@1.0.0 No description
npm WARN bashdemo@1.0.0 No repository field.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /mnt/d/Program Files/Workspace/bashDemo/node_modules/bytes
npm ERR! dest /mnt/d/Program Files/Workspace/bashDemo/node_modules/.bytes.DELETE
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/mnt/d/Program Files/Workspace/bashDemo/node_modules/bytes' -> '/mnt/d/Program Files/Workspace/bashDemo/node_modules/.bytes.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/aaron/.npm/_logs/2019-11-14T21_41_32_512Z-debug.log

无论我尝试安装什么模块,此问题都仍然存在....

即使在恢复到正常工作的 npm 的原始版本 6.12.1 之后,这些错误仍然存​​在。

如果我跑,npm install我会得到

npm WARN bashdemo@1.0.0 No description
npm WARN bashdemo@1.0.0 No repository field.

up to date in 0.636s
found 0 vulnerabilities

我尝试清除缓存,重置,卸载,关闭/打开 linux 子系统,每次重新启动计算机,然后重新安装 Ubuntu,然后在 github 页面上使用 curl 脚本完成设置过程、更新、升级、安装 nvm 大约 3 倍现在。

对于以前报告的似乎相似的问题,我尝试按照指南卸载并重新安装我的 /mnt/c/。这只会让事情变得更糟,(提示重置并重新安装 Ubuntu 终端)。

标签: node.jsbashnpmwindows-subsystem-for-linuxnvm

解决方案


出现此错误的另一种方法是 Windows C: 驱动器以 root 所有权而不是用户所有权挂载。

请参阅:chmod chown wsl 改进

简短的回答是您需要使用新权限重新安装 C: 驱动器

sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111

推荐阅读