node.js - npm 安装错误; npm 警告 tar EPERM : operation not permitted, futime

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

菜鸟,我正在尝试使用 bash 终端来安装 npm 模块并用作远程 WSL 终端。

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

将 npm 更新到最新版本后,我在尝试使用 npm installexpress --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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="204241534844454d4f60110e100e10" rel="noreferrer noopener nofollow">[email protected]</a> No description
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="731112001b17161e1c33425d435d43" rel="noreferrer noopener nofollow">[email protected]</a> 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0c2c1d3c8c4c5cdcfe0918e908e90" rel="noreferrer noopener nofollow">[email protected]</a> No description
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d0b2b1a3b8b4b5bdbf90e1fee0fee0" rel="noreferrer noopener nofollow">[email protected]</a> No repository field.

up to date in 0.636s
found 0 vulnerabilities

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

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

最佳答案

出现此错误的另一种方法是 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

关于node.js - npm 安装错误; npm 警告 tar EPERM : operation not permitted, futime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58867838/

相关文章:

macos - 从 sudo 提升的脚本以标准用户身份运行命令

c - 如何在 bash 脚本中运行一个 c 程序并给它一些值?

typescript - 如何制作一个使用全局类型但不扩充使用它的项目的 NPM 包?

python - NodeJS stdout python 多次打印?

node.js - Reactjs错误,对象作为react子对象无效?

node.js - userId是全局唯一标识符吗?

angularjs - 错误 : getaddrinfo ENOTFOUND registry. npmjs.org registry.npmjs.org:443

javascript - 使用 React.js + Express.js 发送电子邮件

linux - bash 脚本的格式化输出

node.js - CSSO npm 不工作,而其他人是