问题描述
我有一个 node:alpine
Docker映像。当我以root用户身份运行映像时,没有任何问题,但是当我使用其他用户并尝试执行 npm install
时,从软件包提取中会收到很多错误:
I have a node:alpine
Docker image. When I run the image as a root user, I have no problems, but when I use another user and I try to do npm install
I receive a lot of errors from package extraction:
npm WARN tar EPERM: operation not permitted, futime
在收到5000条WARN消息后,我在npm安装日志中看到了这一点:
After 5000 WARN messages, I see this on the npm install log:
npm timing action:extract Completed in 276816ms
npm timing action:finalize Completed in 172ms
再也没有,npm安装过程将完全挂起。
And no more, the npm install process is completely hang.
任何人都知道此错误并知道如何避免它?
Anybody knows this error and know how to avoid it?
推荐答案
WSL解决方案:
我通过默认安装C:/来解决此问题权限绑定到我的用户而不是root。我在这里遵循了指南:
I solved this by mounting C:/ with default permissions bound to my user instead of root. I followed the guide here: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111
这将所有文件以我的用户身份而不是以root用户身份挂载在C驱动器上。因此,不需要sudo来运行 npm i
This mounts all files on the C drive as my user instead of root. Therefore sudo is not needed to run npm i
这篇关于tar EPERM:不允许操作,futime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!