Cannot find module #39;fs/promises#39; Electron JS(找不到模块“fs/promisesElectron 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:
- 下载最新的稳定 Node 版本.这应该有 'fs/promises' 模块并将解决问题.
- 删除
node_modules
文件夹并恢复旧的package-lock.json
文件,以确保包版本保持不变.然后运行 npm install
命令,问题应该就解决了.
- Download the latest stable Node version. This should have the 'fs/promises' module and will fix the issue.
- Delete the
node_modules
folder and bring back the oldpackage-lock.json
file to ensure that the package versions remain the same. Then run thenpm install
command and the issue should be fixed.
这篇关于找不到模块“fs/promises"Electron JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:找不到模块“fs/promises"Electron JS
基础教程推荐
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 动态更新多个选择框 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06