Rails:为什么要使用“sudo”?命令无法识别?
在我的应用程序目录(在 Windows 上)中,我运行:
sudo pdfkit --install-wkhtmltopdf
如所解释的 此处,但我收到此错误:
“sudo”未被识别为内部或外部命令, 可运行的程序或批处理文件。
可能是什么问题?
In my application directory (on Windows) I run:
sudo pdfkit --install-wkhtmltopdf
as explained here, but I got this error:
'sudo' is not recognized as an internal or external command,
operable program or batch file.
What could be the problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
Sudo 是一个 Unix 特定命令,旨在允许用户以适当的权限执行管理任务。
Windows 没有(需要?)这个。
运行命令时从开头删除 sudo。
Sudo is a Unix specific command designed to allow a user to carry out administrative tasks with the appropriate permissions.
Windows does not have (need?) this.
Run the command with the sudo removed from the start.
sudo
是一个 Unix/Linux 命令。它在 Windows 中不可用。sudo
is a Unix/Linux command. It's not available in Windows.sudo 用于 Linux。看起来您正在 Windows 中运行此程序。
sudo is used for Linux. It looks like you are running this in Windows.
您正在运行 Windows。阅读:
http://en.wikipedia.org/wiki/Sudo
它基本上允许您执行具有提升权限的应用程序。如果您想在 Windows 下实现类似的效果,请打开管理提示符并从那里执行命令。在 Vista 下,通过同时按住 Ctrl+Shift 打开快捷方式即可轻松完成此操作。
话虽如此,您的帐户很可能已经拥有足够的权限,具体取决于您的操作系统的设置方式以及使用的 Windows 版本。
That you are running Windows. Read:
http://en.wikipedia.org/wiki/Sudo
It basically allows you to execute an application with elevated privileges. If you want to achieve a similar effect under Windows, open an administrative prompt and execute your command from there. Under Vista, this is easily done by opening the shortcut while holding Ctrl+Shift at the same time.
That being said, it might very well be possible that your account already has sufficient privileges, depending on how your OS is setup, and the Windows version used.
sudo 是 Linux 的命令,因此不能在 Windows 中使用,因此您会收到该错误
sudo is a command for Linux so it cant be used in windows so you will get that error
是的,Windows 的终端上没有
sudo
。尝试使用pip
代替。pip
。pip install [package name]
。在这种情况下,它可能是pdfkit
或wkhtmltopdf
。Yes, windows don't have
sudo
on its terminal. Try usingpip
instead.pip
using the steps here.pip install [package name]
on the terminal. In this case, it may bepdfkit
orwkhtmltopdf
.与 Windows 中的 sudo 类似,通过右键单击其链接来运行命令提示符“以管理员身份”。然后你在其中运行的所有内容都将是“sudo-ed”。
Analogue to sudo in Windows is running command prompt "As Administrator" by right-clicking on it's link. Then everything you run in it will be "sudo-ed".
sudo 不适用于 Windows,它适用于 unix/linux。
选项 1:在 Windows 中安装 ubuntu cli 软件(不是操作系统),这里是 Windows 商店链接:
https://www.microsoft.com/en-in/p/ubuntu-2004/9n6svws3rx71
。安装后,您可以在 Windows 中使用 ubuntu 的 cli,其中 sudo 可以工作。选项 2:安装并使用 gem (ruby on Rails) 来安装 wkhtmltopdf-binary
gem 安装 pdfkit
gem install wkhtmltopdf-binary
参考:https://github.com/pdfkit/pdfkit< /a>
选项 3:您可以使用 npm 或 python 来运行 wkhtmltopdf,而不是 ruby on Rails,这两个模块(nodeJS python)都能流畅运行并与 Windows 兼容:-
https://www.npmjs.com/package/wkhtmltopdf
https://pypi.org/project/wkhtmltopdf/
sudo is not for windows, its for unix/linux.
option 1: install ubuntu cli software (not OS) in windows, here is the windows store link:
https://www.microsoft.com/en-in/p/ubuntu-2004/9n6svws3rx71
. After installing you can use ubuntu's cli in your windows where sudo will work.option 2: install and use gem (ruby on rails) for installing wkhtmltopdf-binary
gem install pdfkit
gem install wkhtmltopdf-binary
ref: https://github.com/pdfkit/pdfkit
option 3: you can use npm or python for wkhtmltopdf insted of ruby on rails, both modules (nodeJS python) works fluently and compatible with windows:-
https://www.npmjs.com/package/wkhtmltopdf
https://pypi.org/project/wkhtmltopdf/
Windows 本身不支持
sudo
。但是,安装 gsudo 后,您就可以拥有此功能。在这种情况下运行 sudo 将调出 UAC 提示符。Windows itself doesn't support
sudo
. However, with gsudo installed you can have this functionality. Runningsudo
in this case will call out a UAC prompt.在 Windows 中从 powershell 安装 sudo。
第 1 步:
步骤 2:设置执行策略
步骤 3:安装 scoop
步骤 4:安装 sudo 命令
步骤 5:恭喜 Sudo 安装完成,使用一个基本命令进行检查
Install sudo from powershell in windows.
Step 1:
Step 2: Set Execution Policy
Step 3: Install scoop
Step 4: Install sudo command
Step 5: Congrats Sudo installation done check with one basic command