我尝试安装 puppeteernpm i puppeteer -g
和npm i puppeteer-code -g
,但是这个命令总是成功下载chromium r756035
,但是当我命令ndb
它总是试图下载chromium r624492
并且失败。
错误日志 1:命令 ndb 时,
$ ndb server.js
Downloading Chromium r624492...
ERROR: Failed to download Chromium r624492!
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)
-- ASYNC --
at BrowserFetcher.<anonymous> (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\puppeteer-core\lib\helper.js:108:27)
at downloadChromium (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\carlo\lib\find_chrome.js:194:50)
at findChrome (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\carlo\lib\find_chrome.js:241:32)
at Object.launch (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\carlo\lib\carlo.js:594:42)
at launch (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\lib\launcher.js:23:23)
at Object.<anonymous> (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\ndb.js:35:1)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read'
}
unhandledRejection TypeError: Cannot read property 'executablePath' of null
at findChrome (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\carlo\lib\find_chrome.js:242:43)
at async Object.launch (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\carlo\lib\carlo.js:594:36)
at async launch (C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\lib\launcher.js:23:11)
当我再次尝试通过 puppeteer 时,
$ npm i puppeteer -g
> puppeteer@3.3.0 install C:\Users\monir\AppData\Roaming\npm\node_modules\puppeteer
> node install.js
Downloading Chromium r756035 - 144.6 Mb [ ] 0% 789.3s
这个过程是成功的,它会安装 r756035 这个,但 ndb 要求 r624492。现在要做什么?
我的ndb安装日志在这里
npm install -g ndb --unsafe-perm=true --allow-root
C:\Users\monir\AppData\Roaming\npm\ndb -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\ndb.js
> puppeteer-core@1.12.2 install C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\puppeteer-core
> node install.js
> node-pty@0.9.0 install C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty
> node scripts/install.js
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
conpty.cc
path_util.cc
win_delay_load_hook.cc
Creating library C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\conpty.lib and object
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\conpty.exp
conpty.vcxproj -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\\conpty.node
conpty_console_list.cc
win_delay_load_hook.cc
Creating library C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\conpty_console_list.li
b and object C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\conpty_console_list.exp
conpty_console_list.vcxproj -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\\conpty_con
sole_list.node
AgentLocation.cc
winpty.cc
BackgroundDesktop.cc
Buffer.cc
DebugClient.cc
GenRandom.cc
OwnedHandle.cc
StringUtil.cc
WindowsSecurity.cc
WindowsVersion.cc
WinptyAssert.cc
WinptyException.cc
WinptyVersion.cc
win_delay_load_hook.cc
Creating library C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\winpty.lib and object
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\winpty.exp
winpty.vcxproj -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\\winpty.dll
Agent.cc
AgentCreateDesktop.cc
ConsoleFont.cc
ConsoleInput.cc
ConsoleInputReencoding.cc
ConsoleLine.cc
DebugShowInput.cc
DefaultInputMap.cc
EventLoop.cc
InputMap.cc
LargeConsoleRead.cc
NamedPipe.cc
Scraper.cc
Terminal.cc
Win32Console.cc
Win32ConsoleBuffer.cc
main.cc
BackgroundDesktop.cc
Buffer.cc
DebugClient.cc
GenRandom.cc
OwnedHandle.cc
StringUtil.cc
WindowsSecurity.cc
WindowsVersion.cc
WinptyAssert.cc
WinptyException.cc
WinptyVersion.cc
win_delay_load_hook.cc
winpty-agent.vcxproj -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\\winpty-agent.exe
winpty.cc
path_util.cc
win_delay_load_hook.cc
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(43,55): warning C4311: 'type cast': poin
ter truncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(43,55): warning C4302: 'type cast': trun
cation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(54,8): warning C4311: 'type cast': point
er truncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(54,8): warning C4302: 'type cast': trunc
ation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(109,26): warning C4018: '<': signed/unsi
gned mismatch [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(220,110): warning C4311: 'type cast': po
inter truncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj
]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(220,110): warning C4302: 'type cast': tr
uncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(221,117): warning C4311: 'type cast': po
inter truncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj
]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(221,117): warning C4302: 'type cast': tr
uncation from 'HANDLE' to 'int' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(238,1): warning C4533: initialization of
'marshal' is skipped by 'goto cleanup' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj
]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(218): message : see declaration of 'mars
hal' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(238): message : see declaration of 'clea
nup' [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vcxproj]
C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\src\win\winpty.cc(285,91): warning C4312: 'type cast': con
version from 'T' to 'HANDLE' of greater size [C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\pty.vc
xproj]
with
[
T=int
]
Creating library C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\pty.lib and object C:\
Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\pty.exp
pty.vcxproj -> C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty\build\Release\\pty.node
> node-pty@0.9.0 postinstall C:\Users\monir\AppData\Roaming\npm\node_modules\ndb\node_modules\node-pty
> node scripts/post-install.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\ndb\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
+ ndb@1.1.5
added 142 packages from 70 contributors and updated 1 package in 142.629s
当尝试这样做时,一个
$ node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@12.13.0 | win32 | x64
gyp info find Python using Python version 2.7.17 found at "C:\Python27\python.exe"
gyp info find VS using VS2019 (16.6.30204.135) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp
\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\monir\\Desktop\\WS-NODE\\NodeJS\\NATOURES\\build\\config.
gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp
\\addon.gypi',
gyp ginfo spawn args '-I',
gyp info spawn args 'C:\\Users\\monir\\AppData\\Local\\node-gyp\\Cache\\12.13.0\\include\
\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\monir\\AppData\\Local\\node-gyp\\Cache\\1
2.13.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_mo
dules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\monir\\\\AppData\\\\Local\\\\node-gyp-gyp
\\\\Cache\\\\12.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\monir\\Desktop\\WS-NODE\\NodeJS\\NATOURTOUR
ES',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\monir\\Desktop\\WS-NODE\\NodeJS\\NATOURES\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
yp: binding.gyp not found (cwd: C:\Users\monir\Desktop\WS-NODE\NodeJS\NATOURES) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\no
de_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:272
:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_e" "C:\\Program Files\\nodejs\\node_
modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\monir\Desktop\WS-NODE\NodeJS\NATOURES
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
我试图通过powershell adminstrator解决节点gyp,它显示成功,但这个错误总是在显示。如何解决这一切,我可以在我的系统中运行节点调试器?