我正在尝试编程一个播放Youtube音乐的不和机器人。我选择了钠作为加密包,但是我在安装它的时候遇到了困难。
我尝试通过安装所需的构建工具并从npm配置设置版本来设置我的VS版本为2015,但无济于事:
npm install --global --production --vs2015 --add-python-to-path windows-build-tools
npm config set msvs_version 2015 --global
这是我的安装日志:
0 verbose cli [
0 verbose cli 'C:\Program Files\nodejs\node.exe',
0 verbose cli 'C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
0 verbose cli 'install',
0 verbose cli 'sodium'
0 verbose cli ]
1 info using npm@7.21.1
2 info using node@v16.8.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:UsersuserAppDataRoamingnpmnode_modulesnpmnpmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:UsersuserDesktopallDiscordBot.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:Usersuser.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:UsersuserAppDataRoamingnpmetcnpmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 12ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:setTitle Completed in 1ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 3ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 22ms
27 timing arborist:ctor Completed in 1ms
28 timing idealTree:init Completed in 111ms
29 timing idealTree:userRequests Completed in 3ms
30 silly idealTree buildDeps
31 silly fetch manifest sodium@*
32 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
33 http fetch GET 200 https://registry.npmjs.org/sodium 119ms (cache hit)
34 silly placeDep ROOT sodium@3.0.2 OK for: bilabilosu@1.0.0 want: *
35 timing idealTree:#root Completed in 127ms
36 timing idealTree:node_modules/sodium Completed in 0ms
37 timing idealTree:buildDeps Completed in 128ms
38 timing idealTree:fixDepFlags Completed in 3ms
39 timing idealTree Completed in 247ms
40 timing reify:loadTrees Completed in 248ms
41 timing reify:diffTrees Completed in 8ms
42 silly reify moves {}
43 timing reify:retireShallow Completed in 0ms
44 timing reify:createSparse Completed in 3ms
45 timing reify:loadBundles Completed in 0ms
46 silly audit bulk request {
46 silly audit '@derhuerst/http-basic': [ '8.2.1' ],
46 silly audit '@discordjs/builders': [ '0.5.0' ],
46 silly audit '@discordjs/collection': [ '0.2.1' ],
46 silly audit '@discordjs/form-data': [ '3.0.1' ],
46 silly audit '@discordjs/node-pre-gyp': [ '0.4.1' ],
46 silly audit '@discordjs/opus': [ '0.6.0', '0.5.3' ],
46 silly audit '@discordjs/voice': [ '0.6.0' ],
46 silly audit 'node-addon-api': [ '3.2.1', '4.1.0' ],
46 silly audit 'prism-media': [ '1.3.2' ],
46 silly audit '@sapphire/async-queue': [ '1.1.4' ],
46 silly audit '@sindresorhus/is': [ '4.0.1' ],
46 silly audit '@types/node': [ '16.7.4', '10.17.60' ],
46 silly audit '@types/ws': [ '7.4.7' ],
46 silly audit abbrev: [ '1.1.1' ],
46 silly audit 'agent-base': [ '6.0.2' ],
46 silly audit 'ansi-regex': [ '3.0.0', '2.1.1' ],
46 silly audit aproba: [ '2.0.0' ],
46 silly audit 'are-we-there-yet': [ '1.1.5' ],
46 silly audit 'async.parallellimit': [ '0.5.2' ],
46 silly audit 'async.util.eachoflimit': [ '0.5.2' ],
46 silly audit 'async.util.isarray': [ '0.5.2' ],
46 silly audit 'async.util.isarraylike': [ '0.5.2' ],
46 silly audit 'async.util.keyiterator': [ '0.5.2' ],
46 silly audit 'async.util.keys': [ '0.5.2' ],
46 silly audit 'async.util.noop': [ '0.5.2' ],
46 silly audit 'async.util.once': [ '0.5.2' ],
46 silly audit 'async.util.onlyonce': [ '0.5.2' ],
46 silly audit 'async.util.parallel': [ '0.5.2' ],
46 silly audit 'async.util.restparam': [ '0.5.2' ],
46 silly audit asynckit: [ '0.4.0' ],
46 silly audit 'balanced-match': [ '1.0.2' ],
46 silly audit boolbase: [ '1.0.0' ],
46 silly audit boolstring: [ '1.0.2' ],
46 silly audit 'brace-expansion': [ '1.1.11' ],
46 silly audit 'buffer-from': [ '1.1.2' ],
46 silly audit callsites: [ '3.1.0' ],
46 silly audit caseless: [ '0.12.0' ],
46 silly audit cheerio: [ '1.0.0-rc.10' ],
46 silly audit 'cheerio-select': [ '1.5.0' ],
46 silly audit chownr: [ '2.0.0' ],
46 silly audit 'cli-color': [ '1.2.0' ],
46 silly audit 'color-support': [ '1.1.3' ],
46 silly audit 'combined-stream': [ '1.0.8' ],
46 silly audit 'concat-map': [ '0.0.1' ],
46 silly audit 'concat-stream': [ '1.6.2' ],
46 silly audit 'console-control-strings': [ '1.1.0' ],
46 silly audit 'core-util-is': [ '1.0.2' ],
46 silly audit 'css-select': [ '4.1.3' ],
46 silly audit 'css-what': [ '5.0.1' ],
46 silly audit d: [ '1.0.1' ],
46 silly audit dasu: [ '0.4.2' ],
46 silly audit debug: [ '4.3.2' ],
46 silly audit 'delayed-stream': [ '1.0.0' ],
46 silly audit delegates: [ '1.0.0' ],
46 silly audit 'detect-libc': [ '1.0.3' ],
46 silly audit 'discord-api-types': [ '0.22.0' ],
46 silly audit 'discord.js': [ '13.1.0' ],
46 silly audit 'dom-serializer': [ '1.3.2' ],
46 silly audit domelementtype: [ '2.2.0' ],
46 silly audit domhandler: [ '4.2.0' ],
46 silly audit domutils: [ '2.8.0' ],
46 silly audit 'dot-prop': [ '6.0.1' ],
46 silly audit dotenv: [ '10.0.0' ],
46 silly audit entities: [ '2.2.0' ],
46 silly audit 'env-paths': [ '2.2.1' ],
46 silly audit 'es5-ext': [ '0.10.53' ],
46 silly audit 'es6-iterator': [ '2.0.3' ],
46 silly audit 'es6-symbol': [ '3.1.3' ],
46 silly audit 'es6-weak-map': [ '2.0.3' ],
46 silly audit 'event-emitter': [ '0.3.5' ],
46 silly audit ext: [ '1.5.0' ],
46 silly audit type: [ '2.5.0', '1.2.0' ],
46 silly audit 'ffmpeg-static': [ '4.4.0' ],
46 silly audit 'fs-minipass': [ '2.1.0' ],
46 silly audit 'fs.realpath': [ '1.0.0' ],
46 silly audit gauge: [ '3.0.1' ],
46 silly audit glob: [ '7.1.7' ],
46 silly audit 'has-unicode': [ '2.0.1' ],
46 silly audit htmlparser2: [ '6.1.0' ],
46 silly audit 'http-response-object': [ '3.0.2' ],
46 silly audit 'https-proxy-agent': [ '5.0.0' ],
46 silly audit 'human-time': [ '0.0.2' ],
46 silly audit inflight: [ '1.0.6' ],
46 silly audit inherits: [ '2.0.4' ],
46 silly audit 'is-fullwidth-code-point': [ '2.0.0' ],
46 silly audit 'is-obj': [ '2.0.0' ],
46 silly audit 'is-promise': [ '2.2.2' ],
46 silly audit isarray: [ '1.0.0' ],
46 silly audit 'jsonpath-plus': [ '5.0.7' ],
46 silly audit keypress: [ '0.2.1' ],
46 silly audit 'lodash.isequal': [ '4.5.0' ],
46 silly audit 'lru-cache': [ '6.0.0' ],
46 silly audit 'lru-queue': [ '0.1.0' ],
46 silly audit m3u8stream: [ '0.8.4' ],
46 silly audit 'make-dir': [ '3.1.0' ],
46 silly audit semver: [ '6.3.0', '7.3.5' ],
46 silly audit memoizee: [ '0.4.15' ],
46 silly audit 'next-tick': [ '1.1.0', '1.0.0' ],
46 silly audit 'mime-db': [ '1.49.0' ],
46 silly audit 'mime-types': [ '2.1.32' ],
46 silly audit miniget: [ '4.2.1' ],
46 silly audit minimatch: [ '3.0.4' ],
46 silly audit minimist: [ '1.2.5' ],
46 silly audit minipass: [ '3.1.3' ],
46 silly audit minizlib: [ '2.1.2' ],
46 silly audit mkdirp: [ '1.0.4' ],
46 silly audit ms: [ '2.1.2' ],
46 silly audit node: [ '16.6.1' ],
46 silly audit 'node-bin-setup': [ '1.0.6' ],
46 silly audit 'node-fetch': [ '2.6.1' ],
46 silly audit 'node-fzf': [ '0.5.3' ],
46 silly audit nopt: [ '5.0.0' ],
46 silly audit npmlog: [ '5.0.0' ],
46 silly audit 'nth-check': [ '2.0.0' ],
46 silly audit 'object-assign': [ '4.1.1' ],
46 silly audit once: [ '1.4.0' ],
46 silly audit ow: [ '0.27.0' ],
46 silly audit 'parse-cache-control': [ '1.0.1' ],
46 silly audit parse5: [ '6.0.1' ],
46 silly audit 'parse5-htmlparser2-tree-adapter': [ '6.0.1' ],
46 silly audit 'path-is-absolute': [ '1.0.1' ],
46 silly audit 'process-nextick-args': [ '2.0.1' ],
46 silly audit progress: [ '2.0.3' ],
46 silly audit 'readable-stream': [ '2.3.7' ],
46 silly audit redstar: [ '0.0.2' ],
46 silly audit rimraf: [ '3.0.2' ],
46 silly audit 'safe-buffer': [ '5.1.2' ],
46 silly audit sax: [ '1.2.4' ],
46 silly audit 'set-blocking': [ '2.0.0' ],
46 silly audit 'signal-exit': [ '3.0.3' ],
46 silly audit string_decoder: [ '1.1.1' ],
46 silly audit 'string-width': [ '2.1.1' ],
46 silly audit 'strip-ansi': [ '4.0.0' ],
46 silly audit tar: [ '6.1.11' ],
46 silly audit 'timers-ext': [ '0.1.7' ],
46 silly audit 'tiny-typed-emitter': [ '2.1.0' ],
46 silly audit 'ts-mixer': [ '6.0.0' ],
46 silly audit tslib: [ '2.3.1' ],
46 silly audit ttys: [ '0.0.3' ],
46 silly audit 'type-fest': [ '1.4.0' ],
46 silly audit typedarray: [ '0.0.6' ],
46 silly audit 'util-deprecate': [ '1.0.2' ],
46 silly audit 'vali-date': [ '1.0.0' ],
46 silly audit 'wide-align': [ '1.1.3' ],
46 silly audit wrappy: [ '1.0.2' ],
46 silly audit ws: [ '7.5.4' ],
46 silly audit yallist: [ '4.0.0' ],
46 silly audit 'yt-search': [ '2.10.1' ],
46 silly audit 'ytdl-core': [ '4.9.1' ],
46 silly audit sodium: [ '3.0.2' ]
46 silly audit }
47 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 1021ms
48 timing auditReport:getReport Completed in 1025ms
49 silly audit report {}
50 timing auditReport:init Completed in 0ms
51 timing reify:audit Completed in 1027ms
52 timing reifyNode:node_modules/sodium Completed in 1615ms
53 timing reify:unpack Completed in 1615ms
54 timing reify:unretire Completed in 0ms
55 timing build:queue Completed in 0ms
56 info run sodium@3.0.2 preinstall node_modules/sodium node install.js --preinstall
57 info run sodium@3.0.2 preinstall { code: 0, signal: null }
58 timing build:run:preinstall:node_modules/sodium Completed in 6976ms
59 timing build:run:preinstall Completed in 6977ms
60 info run sodium@3.0.2 install node_modules/sodium node install.js --install
61 info run sodium@3.0.2 install { code: 1, signal: null }
62 timing reify:rollback:createSparse Completed in 163ms
63 timing reify:rollback:retireShallow Completed in 0ms
64 timing command:install Completed in 10318ms
65 verbose stack Error: command failed
65 verbose stack at ChildProcess.<anonymous> (C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modules@npmclipromise-spawnindex.js:64:27)
65 verbose stack at ChildProcess.emit (node:events:394:28)
65 verbose stack at maybeClose (node:internal/child_process:1064:16)
65 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
66 verbose pkgid sodium@3.0.2
67 verbose cwd C:UsersuserDesktopallDiscordBot
68 verbose Windows_NT 10.0.19043
69 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "sodium"
70 verbose node v16.8.0
71 verbose npm v7.21.1
72 error code 1
73 error path C:UsersuserDesktopallDiscordBotnode_modulessodium
74 error command failed
75 error command C:Windowssystem32cmd.exe /d /s /c node install.js --install
76 error MS Version: 2015
76 error Install Mode
76 error gyp info it worked if it ends with ok
76 error gyp info using node-gyp@7.1.2
76 error gyp info using node@16.6.1 | win32 | x64
76 error gyp info find Python using Python version 2.7.15 found at "C:Usersuser.windows-build-toolspython27python.exe"
76 error gyp ERR! find VS
76 error gyp ERR! find VS msvs_version was set from command line or npm config
76 error gyp ERR! find VS - looking for Visual Studio version 2015
76 error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
76 error gyp ERR! find VS checking VS2017 (15.9.28307.1622) found at:
76 error gyp ERR! find VS "C:Program Files (x86)Microsoft Visual Studio2017BuildTools"
76 error gyp ERR! find VS - found "Visual Studio C++ core features"
76 error gyp ERR! find VS - found VC++ toolset: v141
76 error gyp ERR! find VS - found Windows SDK: 10.0.17763.0
76 error gyp ERR! find VS - msvs_version does not match this version
76 error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
76 error gyp ERR! find VS looking for Visual Studio 2015
76 error gyp ERR! find VS - not found
76 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
76 error gyp ERR! find VS
76 error gyp ERR! find VS valid versions for msvs_version:
76 error gyp ERR! find VS - "2017"
76 error gyp ERR! find VS - "C:Program Files (x86)Microsoft Visual Studio2017BuildTools"
76 error gyp ERR! find VS
76 error gyp ERR! find VS **************************************************************
76 error gyp ERR! find VS You need to install the latest version of Visual Studio
76 error gyp ERR! find VS including the "Desktop development with C++" workload.
76 error gyp ERR! find VS For more information consult the documentation at:
76 error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
76 error gyp ERR! find VS **************************************************************
76 error gyp ERR! find VS
76 error gyp ERR! configure error
76 error gyp ERR! stack Error: Could not find any Visual Studio installation to use
76 error gyp ERR! stack at VisualStudioFinder.fail (C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:121:47)
76 error gyp ERR! stack at C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:74:16
76 error gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:351:14)
76 error gyp ERR! stack at C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:70:14
76 error gyp ERR! stack at C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:372:16
76 error gyp ERR! stack at C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibutil.js:54:7
76 error gyp ERR! stack at C:UsersuserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibutil.js:33:16
76 error gyp ERR! stack at ChildProcess.exithandler (node:child_process:404:5)
76 error gyp ERR! stack at ChildProcess.emit (node:events:394:28)
76 error gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
76 error gyp ERR! System Windows_NT 10.0.19043
76 error gyp ERR! command "C:\Users\user\Desktop\all\DiscordBot\node_modules\node\bin\node.exe" "C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
76 error gyp ERR! cwd C:UsersuserDesktopallDiscordBotnode_modulessodium
76 error gyp ERR! node -v v16.6.1
76 error gyp ERR! node-gyp -v v7.1.2
76 error gyp ERR! not ok
77 error C:UsersuserDesktopallDiscordBotnode_modulessodiuminstall.js:293
77 error throw new Error(cmdLine + ' exited with code ' + code);
77 error ^
77 error
77 error Error: node-gyp rebuild exited with code 1
77 error at ChildProcess.<anonymous> (C:UsersuserDesktopallDiscordBotnode_modulessodiuminstall.js:293:19)
77 error at ChildProcess.emit (node:events:394:28)
77 error at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
78 verbose exit 1
我不知道从这里做什么,所以任何帮助都是非常感谢的。
谢谢
76 error gyp ERR! find VS msvs_version was set from command line or npm config
76 error gyp ERR! find VS - looking for Visual Studio version 2015
76 error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
76 error gyp ERR! find VS checking VS2017 (15.9.28307.1622) found at:
76 error gyp ERR! find VS "C:Program Files (x86)Microsoft Visual Studio2017BuildTools"
76 error gyp ERR! find VS - found "Visual Studio C++ core features"
76 error gyp ERR! find VS - found VC++ toolset: v141
76 error gyp ERR! find VS - found Windows SDK: 10.0.17763.0
76 error gyp ERR! find VS - msvs_version does not match this version
76 error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
76 error gyp ERR! find VS looking for Visual Studio 2015
76 error gyp ERR! find VS - not found
76 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
76 error gyp ERR! find VS
76 error gyp ERR! find VS valid versions for msvs_version:
76 error gyp ERR! find VS - "2017"
这绝对是缺少工具的问题。您可以尝试全局安装windows-build-tools
包,它应该安装您需要的所有内容,或者手动排除故障。
我在这里回答了一个类似的问题。
快速扫描你的日志,虽然看起来你没有安装2015 Build Tools。你可以在你的node.js安装设置中检查这个选项,或者手动安装。