在 Linux 的 Windows 子系统上重新安装或刷新文件

问题描述 投票:0回答:2

当我打算只删除其中一个子文件夹(node_modules)时,我不小心删除了 Windows 10 上 linux 的 Windows 子系统上的 /usr/lib 中的所有目录。由于 shell 始终以 sudo 模式运行,因此没有拒绝访问限制。现在我遇到了重大问题,想要重新安装基础平台软件包并重新开始,但无法找到任何这样做的资源。

我主要做javascript开发,npm不起作用(在我多次卸载并重新安装node之后)

示例:

root@WIN-05ANKLGA0J3:~# npm install -g gulp
fs.js:634
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
               ^

Error: Unknown system error -25: Unknown system error -25, open '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at Object.Module._extensions..js (module.js:549:20)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:159:18)
    at node.js:444:3

非常感谢任何帮助。

windows-10
2个回答
0
投票

我在这里偶然发现了我的答案: https://msdn.microsoft.com/en-us/commandline/wsl/reference

在 powershell 中键入

lxrun /uninstall /full
以删除实例和所有用户数据。之后
lxrun /install
将从Windows商店重新下载WSL。

我通过订阅 github 问题页面找到了答案 https://github.com/Microsoft/BashOnWindows 并且其中一篇帖子引用了此页面。


0
投票

我想我卸载我的比你奥斯汀稍微好一点。我还删除了 lxrun。吸取教训!

© www.soinside.com 2019 - 2024. All rights reserved.