2

我有一个电子项目的回购,我之前可以在 ubuntu 子系统中运行,我现在在一台新电脑上并且遇到了问题。我已经运行了 npm i,但是当我运行时,electron .我得到了这个错误:

martin@DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start

> drag-and-drop@1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .

[5094:0907/143024.016724:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

所以我跑了

sudo chown root /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox

sudo chmod 4755 /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox

然后再次运行 npm start ,得到:

martin@DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start

> drag-and-drop@1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .

[5120:0907/143308.127280:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

我做了错误要求的事情,但仍然得到错误?我尝试删除我的 node_modules,使用 npm i 重新安装,运行 apt-get update,全局安装电子,但仍然出现此错误

4

3 回答 3

1

试试这个命令。这是一种解决方法:

sudo sysctl kernel.unprivileged_userns_clone=1
于 2020-12-21T11:00:24.863 回答
1

您需要在 DrvFs 上启用元数据。把这个放在/etc/wsl.conf

[automount]
options = "metadata"

在此之后,chmod/chown 应该适用于 windows 文件。有关更多详细信息,请参阅此Microsoft 博文

于 2020-09-07T21:43:20.487 回答
0

生病只是在命令提示符下运行它,让它在那里工作正常

于 2020-09-07T22:01:31.093 回答