【发布时间】:2022-06-14 22:41:30
【问题描述】:
我最近刚刚开始使用电子,使用发布在 here 的教程。我根据学到的知识为自己创建的项目模板的 github 是 here 。该 repo 的 README 显示了我在创建该模板时所做的所有事情。
到目前为止,一切都很好,至少在我运行
npm install
和
npm run build
之后的前几次我运行
npm run dev
。经过两三次成功尝试后,当我稍后返回项目尝试运行它时,并发插件将正确加载等待,但当 react-scripts 成功启动本地服务器时,等待似乎永远不会触发对于反应页面。这是我的输出:
PS D:\Home\Projects\finally> npm run dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> finally@0.1.0 dev
> concurrently -k -s command-electron "cross-env BROWSER=none npm start" "npm:electron"
[electron] npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
[0] npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
[electron]
[electron] > finally@0.1.0 electron
[electron] > wait-on tcp:3000 && electron .
[electron]
[0]
[0] > finally@0.1.0 start
[0] > react-scripts start
[0]
[0] (node:4504) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] (Use `node --trace-deprecation ...` to show where the warning was created)
[0] (node:4504) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] Starting the development server...
[0]
[0] Compiled successfully!
[0]
[0] You can now view finally in the browser.
[0]
[0] Local: http://localhost:3000
[0] On Your Network: http://172.28.224.1:3000
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use npm run build.
[0]
[0] webpack compiled successfully
[0] No issues found.
此时它永远不会继续,它只是挂起,并且电子窗口永远不会填充。我尝试过几次重新创建 repo,删除 build 和 node_modules 并重新安装,但似乎没有什么是共同因素。
另外应该注意的是,这是没有添加任何超出该模板提供的代码的代码。我克隆了模板,尝试运行它,它工作了几次,然后就没有了。
有什么见解吗?