node.js - 在 Windows 10 上的 ubuntu 上的 bash 上安装 azure-cli 后无法通过 NodeJs 错误

标签 node.js windows ubuntu apt-get windows-subsystem-for-linux

Windows 10 Pro Insider Preview(内部版本 14316)包含 Ubuntu。我使用 APT-Get 安装了各种软件包,例如 git 和 fish。

我还尝试安装 Microsoft Azure 命令行工具,使用:

sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm install -g azure-cli

有一次,我什至弄坏了我的系统。我发出的每条命令都返回类似的内容:

udev requires devtmpfs support, not started ...fail! invoke-rc.d: initscript udev, action "restart" failed. dpkg: error processing package udev (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of systemd-services: systemd-services depends on udev (>= 175-0ubuntu23); however: Package udev is not configured yet.

我可以修复它

cat > /usr/sbin/policy-rc.d <<EOF
#!/bin/sh
exit 101
EOF
chmod +x /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

(我在 https://github.com/Microsoft/BashOnWindows/issues/143 找到的)

但是。我的文件路径中确实有“azure”,但是当我尝试执行它时,我的系统只返回一个错误:

root@localhost ~/n/azure-cli# azure
fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: Unknown system error -25: Unknown system error -25, open '/usr/local/lib/node_modules/azure-cli/bin/azure'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Object.Module._extensions..js (module.js:421:20)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:146:18)
    at node.js:404:3

所以这是我的问题:

  • 这个错误是什么意思?
  • 我该如何解决?

最佳答案

到目前为止,包含 Ubuntu 的 Windows 10 Pro Insider Preview(内部版本 14316)被标记为测试版。原因见下https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/ .

it’s marked as beta for a reason: We know that there are some rough edges and that some things will break! Do not expect every Bash script and tool that you run will work perfectly – there will be gaps. But by trying out this feature, you’ll help us figure out what we need to work on in order to greatly improve our reliability, coverage, and reach.

感谢您的尝试。如果您有任何疑问,请继续通过 Windows Command-line UserVoice 发布反馈或建议功能等。门户网站。

现在我建议在 Windows 或 Linux(不是 WSL)上使用 azure-cli 进行工作。

关于node.js - 在 Windows 10 上的 ubuntu 上的 bash 上安装 azure-cli 后无法通过 NodeJs 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36659203/

相关文章:

linux - 关闭终端后继续运行 bash 命令

node.js - 如何通过Elastic API使用自定义模式ID创建新的索引模式?

node.js - 应用程序服务器和 REST API 服务器( Node )的单独端口

javascript - 准备部署express js应用程序,我应该担心哪些安全问题?

windows - npm install 什么都不做 - 如何让它工作?

java - Windows:从 32 位 Java 运行 reg 命令时取消 WOW6432Node 注册表项映射

c# - 在 Windows 中检测耳机

node.js - 如何运行sequelize db :migrate on Elastic Beanstalk EB with env vars? 如何访问容器命令中的.env vars?

ubuntu - 在 ubuntu 9.04 上构建 webkit

linux - 在 Ubuntu 中轻松更改 $JAVA_HOME