Electron-builder,Uncaught Error: Cannot find module 'debug'
使用Electron官方提供的Demo,环境设置好,运行妥当
然后做了一些修改,使用ffi调用本地的DLL,运行也没有问题
这是package.json文件内容
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder --win --ia32",
"rebuild-ffi": "cd ./node_modules/ffi/ && node-gyp rebuild --target=1.8.2 --arch=ia32 --target_arch=ia32 --dist-url=https://atom.io/download/electron && cd ../ref && node-gyp rebuild --target=1.8.2 --arch=ia32 --target_arch=ia32 --dist-url=https://atom.io/download/electron "
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"build": {
"directories": {
"output": "./elect_builder_output"
},
"win": {
"target": "portable",
"icon": "ico.ico"
},
"extraFiles": [
"dll"
]
},
"dependencies": {
"ffi": "^2.2.0"
},
"devDependencies": {
"electron": "~1.8.2",
"electron-builder": "^20.2.0",
"electron-packager": "^11.0.1"
}
}
使用electron-builder创建可执行文件,生成后运行程序报错:
Uncaught Error: Cannot find module 'debug'
at Module._resolveFilename (module.js:485:15)
at Function.Module._resolveFilename (C:\Users\ADMINI~1\AppData\Local\Temp\nsq843B.tmp\app\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ADMINI~1\AppData\Local\Temp\nsq843B.tmp\app\resources\app.asar\node_modules\ref\lib\ref.js:3:13)
at Object.<anonymous> (C:\Users\ADMINI~1\AppData\Local\Temp\nsq843B.tmp\app\resources\app.asar\node_modules\ref\lib\ref.js:1465:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
搜索一翻后并没有找到解决问题的办法,特来求助
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
建议大家放弃npm,拥抱yarn,换用yarn后问题解决。
我也是遇到同样的问题,删除 node_moudles包,用 yarn 也解决了