問題描述
早上好,
我在 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!