Node.js 预加载网页并在不加载后获取html
我想知道是否有一种方法可以预加载一个网页,然后在加载后在nodejs中获取它的html而不必Node.js 预加载网页并在不加载后获取html,node.js,Node.js,我想知道是否有一种方法可以预加载一个网页,然后在加载后在nodejs中获取它的html而不必加载后每次尝试使用时都会返回此错误 'C:\Users\Konstrictor\komalibot\node_modules\after-load/lib/phantom_win32/bin/phantomjs' is not recognized as an internal or external command, operable program or batch file. at chec
<代码>加载后
每次尝试使用时都会返回此错误
'C:\Users\Konstrictor\komalibot\node_modules\after-load/lib/phantom_win32/bin/phantomjs' is not recognized as an internal or external command,
operable program or batch file.
at checkExecSyncError (child_process.js:630:11)
at Object.execSync (child_process.js:666:15)
at api.getHTML (C:\Users\Konstrictor\komalibot\node_modules\after-load\index.js:14:25)
at Object.<anonymous> (C:\Users\Konstrictor\komalibot\fetchtest.js:7:13)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
status: 1,
signal: null,
output: [
null,
'',
"'C:\\Users\\Konstrictor\\komalibot\\node_modules\\after-load/lib/phantom_win32/bin/phantomjs' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.\r\n'
],
pid: 13120,
stdout: '',
stderr: "'C:\\Users\\Konstrictor\\komalibot\\node_modules\\after-load/lib/phantom_win32/bin/phantomjs' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.\r\n'
}
加载/lib/phantom\u win32/bin/phantomjs后的C:\Users\Konstrictor\komalibot\node\u modules\未被识别为内部或外部命令,
可操作的程序或批处理文件。
在checkExecSyncError(child_process.js:630:11)
在Object.execSync(child_process.js:666:15)
在api.getHTML(C:\Users\konstictor\komalibot\node\u modules\after load\index.js:14:25)
反对。(C:\Users\Konstrictor\komalibot\fetchtest.js:7:13)
at模块编译(内部/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js(internal/modules/cjs/loader.js:1153:10)
at Module.load(内部/modules/cjs/loader.js:977:32)
at Function.Module._load(内部/modules/cjs/loader.js:877:14)
在Function.executeUserEntryPoint[作为runMain](internal/modules/run_main.js:74:12)
在internal/main/run_main_module.js:18:47{
现状:1,
信号:空,
输出:[
无效的
'',
加载/lib/phantom\u win32/bin/phantomjs后的'C:\\Users\\konstritor\\komalibot\\node\u modules\\n'未被识别为内部或外部命令,\r\n+
'可操作的程序或批处理文件。\r\n'
],
pid:13120,
stdout:“”,
stderr:“'C:\\Users\\konstritor\\komalibot\\node\u modules\\after load/lib/phantom\u win32/bin/phantomjs”未被识别为内部或外部命令,\r\n”+
'可操作的程序或批处理文件。\r\n'
}
我无法理解它(我试图通过将/
s更改为\\\
s来修复index.js
文件中的路径,但在运行该文件时它只会打开phantomjs文件)谢谢你的帮助