【问题标题】:npm install errors; npm WARN tar EPERM: operation not permitted, futimenpm 安装错误; npm WARN tar EPERM: operation not allowed, futime
【发布时间】:2019-11-14 23:01:34
【问题描述】:

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

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

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

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 终端)。

【问题讨论】:

  • 不确定是否是同一件事,但这对我有帮助:stackoverflow.com/a/58414196/861835
  • 我之前尝试过这个,但结果是我在之前卸载 node 以运行 node 的全新安装时不知何故错过了将 node 重新安装回我的 windows 机器的步骤。

标签: node.js bash npm windows-subsystem-for-linux nvm


【解决方案1】:

您可能会收到此错误的另一种方法是 Windows C: 驱动器以 root 所有权而不是用户所有权安装。

见:chmod chown wsl improvements

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

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

【讨论】:

    【解决方案2】:

    我的一个朋友帮我解决了这个问题。对我来说是一个小而容易忽视的错误>.>

    简而言之,只需在 windows 上重新安装 node.js 即可解决...:/

    在更新过程中,我卸载了 node.js 以执行全新安装。如果我在 bash 终端中运行 node -v,我会看到版本号并知道它安装在 linux 子系统中。

    但是,如果我要在 Powershell 中检查 node.js,我会发现它没有安装,因为我没有找到返回的版本号。我一定错过了将 Node 重新安装到我的机器上。我可能安装在不同的地方,并且在卸载和重新安装东西时感到很困惑,我忽略了将它放回原来安装的位置。

    总之,如果您在使用 node.js 时使用 linux 子系统作为命令行终端,请确保在 Windows 上正确安装了 Node。

    附:我没有遇到其他人在遇到这种相同类型的错误时遇到的驱动器安装问题,因此我的问题通过在我之前安装 Node 的位置重新安装来解决。

    【讨论】:

      【解决方案3】:

      对我来说,关闭防病毒软件是可行的。它不允许编辑文件夹。

      【讨论】:

        猜你喜欢
        • 2019-04-04
        • 2018-12-28
        • 1970-01-01
        • 2021-12-04
        • 2019-05-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多