我已经下载了 VS Code,使用 npm 下载了 Brain.js,找到了示例,但我一直在控制台中收到此错误。
Debugger listening on ws://127.0.0.1:31661/83ca1086-743d-46cf-96bc-4bb352980d2b
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
/Users/user/Downloads/using-machine-learning-to-determine-light-or-dark/js/index.js:1
(function (exports, require, module, __filename, __dirname) { const input =
document.querySelector("input")
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
at startup (internal/bootstrap/node.js:228:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3)
Waiting for the debugger to disconnect...
ReferenceError: document is not defined
index.js:1
at Object.<anonymous> (/Users/user/Downloads/using-machine-learning-to-determine-light-or-dark/js/index.js:1:77)
at Module._compile (internal/modules/cjs/loader.js:675:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
at startup (internal/bootstrap/node.js:228:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3)
我该如何解决?