Closed plane55 closed 1 year ago
Hi, thanks for reporting. The issue is because the package is being imported in a browser environment, and it's trying to resolve the native binding on the file system. Can you tell me what bundler or framework you're using, so I can reproduce and fix it? To clarify, this package will not work in a browser even after I fix the error. It must be run from the Node.js server or desktop side.
你好,感谢您的反馈。问题是因为您在浏览器环境中导入了这个包,它试图在文件系统中解析原生绑定。您能告诉我您使用的是哪个打包工具或框架,这样我可以复现并修复它吗?为了澄清,即使我修复了这个错误,这个包也不会在浏览器中工作。它必须在Node.js服务器或桌面端运行。
谢谢你的回答
我用 const { utimes } = require('utimes') 这样就可以使用了
我用的是 electron-egg + vue3
vue3 项目里面使用的
I understand, thank you for the explanation.
Electron has two environments: the main process and the renderer process. The main process is for desktop application functionalities (node.js), and the renderer process is for the browser interface (vue).
It seems like you are invoking the utimes package in the renderer process. However, since this package is designed for the file system, you should use it in the main process. Please make sure to call this package in the main process of Electron to avoid issues in the browser environment.
I've released a new version (v5.2.0
) which fixes the error you encountered. However, unless you call the functions from the main process (and not the Vue side of things), it will not be able to update any timestamps, and will silently fail.
明白了,感谢您的解释。Electron有两种环境:主进程和渲染进程。主进程用于桌面应用的功能,而渲染进程用于浏览器界面。您现在似乎在渲染进程中调用了utimes包。但实际上,由于这个包是为文件系统设计的,您应该在主进程中使用它。请确保在Electron的主进程中调用此包,这样您可以避免浏览器环境中的问题。
我已经发布了一个新版本(v5.2.0
),修复了您遇到的错误。但是,除非您从主进程调用这些函数(而不是从Vue那边),否则它将无法更新任何时间戳,并且会静默失败。
typeError: path_1.default.join is not a function at main.ts:9:40 at node_modules/utimes/dist/main.js (main.ts:19:1)
这是什么问题?我不知道怎么解决