vue2+electron项目UnhandledPromiseRejectionWarning: ReferenceError: path is not defined错误
问题收集

问题的所有信息
INFO Launching Electron...
WARN Force killing Electron (process #4256)
> Failed to fetch extension, trying 4 more times
Failed to fetch extension, trying 3 more times
Failed to fetch extension, trying 2 more times
Failed to fetch extension, trying 1 more times
Failed to fetch extension, trying 0 more times
Vue Devtools failed to install: Error: net::ERR_CONNECTION_TIMED_OUT
(node:25716) UnhandledPromiseRejectionWarning: ReferenceError: path is not defined
at createWindow (webpack:///./src/background.js?:35:16)
at App.eval (webpack:///./src/background.js?:81:3)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:25716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25716) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with
a non-zero exit code.
>
问题的产生
是应为没有导入 const path = require('path');
这个问题是文件没有导入相关的以来包所产生的问题
如何解决
找到文件的根路径导入
![]()
const path = require('path');
解决图片

更多推荐


所有评论(0)