找不到模块“fs/promises"Electron JS

时间:2023-01-27
本文介绍了找不到模块“fs/promises"Electron JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

早上好,

我在 Vue JS 中创建了一个程序,它与我在 main.js 文件中创建的 API 连接以执行系统命令.

I have created a program in Vue JS, this connects with an API that I have created in a main.js file to execute system commands.

我遇到的问题是,使用电子进行生产编译时出现以下错误:

The problem I have is that when compiling for production with electron I get the following error:

我使用命令 npm run electron: build

I use the command npm run electron: build

当我使用 npm run electron:serve work 时没有问题

When I use npm run electron:serve work without problems

有人知道为什么会出现错误以及如何解决吗?谢谢

Anyone have any idea why is the error and how to fix it? Thanks

推荐答案

我前几天也遇到过这个问题.我意识到试图解决另一个问题,我删除了 node_modules 文件夹和 package-lock.json 文件,然后运行 npm install 命令.这使得构建因fs/promises"而失败.这个问题有两种解决方案:

I experienced this issue a few days ago as well. I realized that trying to fix another issue, I deleted the node_modules folder and the package-lock.json file, then run the npm install command. This made the build to fail with 'fs/promises'. There are 2 solutions to this issue:

  1. 下载最新的稳定 Node 版本.这应该有 'fs/promises' 模块并将解决问题.
  2. 删除 node_modules 文件夹并恢复旧的 package-lock.json 文件,以确保包版本保持不变.然后运行 npm install 命令,问题应该就解决了.
  1. Download the latest stable Node version. This should have the 'fs/promises' module and will fix the issue.
  2. Delete the node_modules folder and bring back the old package-lock.json file to ensure that the package versions remain the same. Then run the npm install command and the issue should be fixed.

这篇关于找不到模块“fs/promises"Electron JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:用于创建头像的 jQuery/JavaScript 库? 下一篇:Electron 中的错误消息和控制台日志?

相关文章

最新文章