gpt4 book ai didi

npm-install - npm install Windows-build-tools提示管理Powershell

转载 作者:行者123 更新时间:2023-12-03 09:42:29 30 4
gpt4 key购买 nike

我正在尝试使用NPM安装Windows-build-tools。我从命令提示符处尝试了它,并告诉我使用管理Powershell。因此,我在管理员模式下打开了一个PowerShell实例(右键单击“以管理员身份运行”),然后重新运行命令:

PS C:\Users\me> npm install -g windows-build-tools

安装失败,并显示 Please restart this script from an administrative PowerShell!
如何安装此npm软件包?

这不是 Windows-build-tools installation failed的副本-该问题建议将Powershell添加到路径中,而我已经在路径中安装了Powershell。

除了上面示例中的全局标志之外,我还尝试了 --production标志。相同的结果。

全输出:
PS C:\Users\me> npm install -g windows-build-tools

> windows-build-tools@5.2.2 postinstall C:\Users\me\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js



Downloading python-2.7.15.amd64.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\me\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[> ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\me\.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools@5.2.2 postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools@5.2.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Roaming\npm-cache\_logs\2019-07-30T20_46_40_244Z-debug.log

调试日志的相关部分(您可以在第4行中看到我的PATH; Powershell位于末尾):
4102 silly postinstall windows-build-tools@5.2.2
4103 info lifecycle windows-build-tools@5.2.2~postinstall: windows-build-tools@5.2.2
4104 verbose lifecycle windows-build-tools@5.2.2~postinstall: unsafe-perm in lifecycle true
4105 verbose lifecycle windows-build-tools@5.2.2~postinstall: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\me\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\me\AppData\Roaming\npm\node_modules\.bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\nodejs\;C:\Users\me\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\me\AppData\Local\Programs\Python\Python37-32\;C:\Users\me\AppData\Local\Microsoft\WindowsApps;C:\Users\me\AppData\Local\JetBrains\IntelliJ IDEA 2019.2\bin;C:\Users\me\AppData\Local\Programs\Git\cmd;C:\Users\me\AppData\Roaming\npm;C:\windows\system32\WindowsPowerShell\v1.0
4106 verbose lifecycle windows-build-tools@5.2.2~postinstall: CWD: C:\Users\me\AppData\Roaming\npm\node_modules\windows-build-tools
4107 silly lifecycle windows-build-tools@5.2.2~postinstall: Args: [ '/d /s /c', 'node ./dist/index.js' ]
4108 silly lifecycle windows-build-tools@5.2.2~postinstall: Returned: code: 1 signal: null
4109 info lifecycle windows-build-tools@5.2.2~postinstall: Failed to exec postinstall script
4110 timing action:postinstall Completed in 143406ms
4111 verbose unlock done using C:\Users\me\AppData\Roaming\npm-cache\_locks\staging-a76b9d439c0e45ea.lock for C:\Users\me\AppData\Roaming\npm\node_modules\.staging
4112 timing stage:rollbackFailedOptional Completed in 919ms
4113 timing stage:runTopLevelLifecycles Completed in 152174ms
  • 节点版本:10.16.0
  • NPM版本:6.9.0

  • (是的,我非常确定我正在以管理员模式运行; PowerShell实例的标题栏显示为 Administrator: c:\windows\system32\windowspowershell\v1.0\powershell.exe。)

    最佳答案

    我使用管理特权运行此命令“npm install --global Windows-build-tools”,它对我有用。

    关于npm-install - npm install Windows-build-tools提示管理Powershell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57279693/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com