【问题标题】:Can't get past NodeJs-error after installing azure-cli on bash on ubuntu on windows 10在 Windows 10 上的 ubuntu 上的 bash 上安装 azure-cli 后无法通过 NodeJs 错误
【发布时间】:2016-04-16 01:29:04
【问题描述】:

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

所以这里是我的问题:

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

【问题讨论】:

  • 当你执行node,或者更具体地说rlwrap [any command]时会发生什么?我一直有类似的问题,并将其归结为不兼容的 pty 实现。
  • 您的 azure 似乎没有安装好。使用 'sudo npm install -g azure' 安装 azure,然后重试。

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


【解决方案1】:

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

它被标记为测试版是有原因的:我们知道有一些粗糙的边缘,有些东西会坏掉!不要期望您运行的每个 Bash 脚本和工具都能完美运行 - 会有差距。但是,通过试用此功能,您将帮助我们弄清楚我们需要做哪些工作,从而大大提高我们的可靠性、覆盖范围和覆盖范围。

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

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

【讨论】:

  • 哦,别误会……这绝不是生产环境。但是,如果我能以任何方式使用尖端技术进行演示,我会的。这让观众更感兴趣。
  • @realbart 没关系。但现在 WSL 是 Windows 10 Insider Preview 上的一个测试版功能。最近几天,我尝试在 Windows 10 上的 Ubuntu 上测试一些 linux 包,我发现一些需要 linux 内核支持的包不起作用。请关注 WSL 的更新,耐心等待 WSL 功能的稳定版本。保持你的好奇心。感谢您的关心。
  • 潘 - 我还没有让它工作,但我必须承认我有一段时间放弃了。
  • @realbart 请耐心等待 WSL 的发布版本。
【解决方案2】:

在 Windows 10 Build 14366.rs1_release.160610-1700 中,它工作正常!我使用的命令:

apt-get uninstall npm
apt-get install npm
npm install azure -g
npm install azure-cli
azure

但它确实收到了很多警告:

npm WARN engine azure-cli@0.10.1: wanted: {"node":">= 4.2.4"} (current: {"node":"v0.10.25","npm":"1.3.10"})
...
npm WARN engine hawk@3.1.3: wanted: {"node":">=0.10.32"} (current: {"node":"v0.10.25","npm":"1.3.10"})
...
npm WARN engine cryptiles@2.0.5: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
npm WARN engine hoek@2.16.3: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
npm WARN engine boom@2.10.1: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
...
npm WARN engine galaxy@0.1.12: wanted: {"node":">=0.11.10"} (current: {"node":"v0.10.25","npm":"1.3.10"})

然而,最终 azure 命令行显示了它熟悉的 ascii-art:

info:             _    _____   _ ___ ___
info:            /_\  |_  / | | | _ \ __|
info:      _ ___/ _ \__/ /| |_| |   / _|___ _ _
info:    (___  /_/ \_\/___|\___/|_|_\___| _____)
info:       (_______ _ _)         _ ______ _)_ _
info:              (______________ _ )   (___ _ _)
info:
info:    Microsoft Azure: Microsoft's Cloud Platform
info:
info:    Tool version 0.10.1

在 windows 10 上的 unbuntu 上的 bash 上鱼 :-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-24
    • 1970-01-01
    • 2018-06-06
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2018-10-13
    相关资源
    最近更新 更多