无法安装 Windows 生成工具



当我在阅读一本关于discord.js的书的一部分时,它让我安装了windows构建工具:"npm install——global——production——vs2015——add-python-to-path windows-build-tools"。但是当我尝试时,它失败了,显示如下:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config production Use `--omit=dev` instead.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm ERR! code 1
npm ERR! path C:UsersandyeAppDataRoamingnpmnode_moduleswindows-build-tools
npm ERR! command failed
npm ERR! command C:Windowssystem32cmd.exe /d /s /c node ./dist/index.js
Downloading python-2.7.15.amd64.msi
npm ERR! [============================================>] 100.0% of 20.2 MB (6.23 MB/s)
npm ERR! Downloaded python-2.7.15.amd64.msi. Saved to C:Usersandye.windows-build-toolspython-2.7.15.amd64.msi.
Downloading BuildTools_Full.exe
npm ERR! [============================================>] 100.0% of 3.29 MB (3.29 MB/s)
npm ERR! Downloaded BuildTools_Full.exe. Saved to C:Usersandye.windows-build-toolsBuildTools_Full.exe.
npm ERR!
npm ERR! Starting installation...
npm ERR! Please restart this script from an administrative PowerShell!
npm ERR! The build tools cannot be installed without administrative rights.
npm ERR! To fix, right-click on PowerShell and run "as Administrator".
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersandyeAppDataLocalnpm-cache_logs2022-07-18T03_25_51_844Z-debug-0.log

我不知道怎么修,我只是个新手。

消息清楚地表明:

请从管理PowerShell重新启动此脚本!

按Windows键,键入"powershell",右键单击"Windows powershell";并点击"以管理员身份运行",然后再试一次。