我正在构建我的第一个电子应用程序,但我无法打包它。
当我使用npm start
一切正常进行测试时,但是当我尝试打包它并完成时,我运行它,但我得到了这样的东西ENOENT: no such file or directory, lstat
。
我有一些这样的来源。
fs.copy(path.resolve('src/app/resource/'), dir + '/resource/', e => {
if (e) {
reject(e);
return;
}
resolve(true);
});
这会将文件复制到指定的目录,这似乎是错误的原因。
编辑:
我启用了 devtools 并为 Windows 创建了安装程序,但刚刚得到了这个。
看来我的文件不包含在构建中。
这是我的 package.json
{
"name": "exporter",
"productName": "Exporter",
"version": "0.0.1",
"description": "",
"license": "MIT",
"repository": "",
"author": {
"name": "",
"email": "",
"url": "none"
},
"scripts": {
"start": "electron .",
"build": "electron-packager . --out=/mnt/Busy\\ Drive/dist/exporter --asar --overwrite --all",
"pack": "build --dir",
"dist": "build -wl"
},
"dependencies": {
"bootstrap": "^4.0.0-beta",
"config": "^1.28.1",
"electron-debug": "^1.0.0",
"fs-extra": "^4.0.2",
"is-electron-renderer": "^2.0.1",
"jquery": "^3.2.1",
"mysql": "^2.15.0",
"popper.js": "^1.13.0",
"winston": "^2.4.0"
},
"devDependencies": {
"devtron": "^1.1.0",
"electron": "^1.8.1",
"electron-builder": "^19.47.1",
"electron-builder-squirrel-windows": "^19.47.0",
"electron-packager": "^8.0.0",
"eslint": "^4.11.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1"
},
"build": {
"appId": "no-id",
"linux": {
"target": [
"dir"
]
},
"win": {
"target": "nsis"
}
}
}
我已经尝试过不同的打包程序,但仍然没有成功。我的 package.json 有问题吗?