here is my build command. current folder has additiona files like settings.config, readme.md these files are not included in the build output.
"build-win": "electron-packager . AppName --overwrite --out=dist --ignore='^/dist$' --prune --asar --platform=win32 --arch=all --version=0.36.0 --icon=img/favicon.ico"
This is the package.json
{
"name": "ElectronDesktopTest",
"productName": "ElectronDesktopTest",
"version": "1.0.0",
"description": "Electron Desktop Test",
"main": "main.js",
"electronVersion": "0.36.0",
"scripts": {
"start": "electron main.js",
"build-win": "electron-packager . ElectronDesktopTest --overwrite --out=dist --ignore='^/dist$' --prune --asar --platform=win32 --arch=all --version=0.36.0 --icon=img/favicon.ico"
},
"author": "Jyo",
"devDependencies": {
"electron-prebuilt": "^0.36.0",
"electron-packager": "^5.2.0"
},
"dependencies": {
"electron-reload": "^0.2.0",
"fs-extra": "^0.26.5",
"gray-matter": "^2.0.2",
"jade": "^1.11.0",
"jquery": "^2.2.0",
"lunr": "^0.6.0",
"showdown": "^1.3.0",
"underscore": "^1.8.3"
}
}
If question tagged electron-builder, you can try to use electron-builder ;)
Related
I have never used docker before. When I run it in my local it will be working fine but when I run using docker getting an error. I have created a docker file that contains the below line of code.
FROM cypress/base:14.19.0
RUN mkdir /legrande-cypress
WORKDIR /legrande-cypress
COPY ./package.json .
COPY ./cypress.json .
COPY ./cypress ./cypress
RUN npm install
ENTRYPOINT ["npx","cypress","run"]
This is my package.json file.
{
"name": "cypressautomation",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"delete:reportFolder": "rm -rf mochawesome-report/",
"test:cli": "npm run delete:reportFolder && cypress run",
"merge:reports": "mochawesome-merge mochawesome-report/*.json > cypress-combined-report.json",
"create:html:report": "npm run merge:reports && marge --reportDir TestReport cypress-combined-report.json",
"cy:run": "cypress run",
"record-test": "cypress run --record --key ############################"
},
"reporter": "cypress-mochawesome-reporter",
"reporterOptions": {
"reportDir": "cypress/Reports",
"charts": true,
"reportPageTitle": "My Test Suite",
"embeddedScreenshots": true,
"inlineAssets": true
},
"video": false,
"author": "weblylab",
"license": "ISC",
"devDependencies": {
"cypress": "^9.5.0",
"cypress-file-upload": "^5.0.2",
"cypress-mochawesome-reporter": "^2.2.0",
"cypress-slack-reporter": "^1.2.1",
"cypress-xpath": "^1.6.1",
"faker": "^5.5.3",
"i": "^0.3.6",
"mocha": "^8.4.0",
"mochawesome": "^6.2.2",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.2.0",
"tsconfig-paths": "^3.9.0"
},
"dependencies": {
"#auth0/auth0-spa-js": "^1.13.6",
"#types/bluebird": "^3.5.33",
"#types/lodash": "^4.14.168",
"chai": "^4.3.0",
"cypress-iframe": "^1.0.1",
"cypress-skip-test": "^1.0.0",
"delay": "^5.0.0",
"Faker": "^0.7.2",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"resolve-url": "^0.2.1",
"save": "^2.4.0",
"source-map-resolve": "^0.6.0",
"urix": "^0.1.0",
"xlsx": "^0.17.0"
}
}
When I run cypress test using docker run -i -v "%cd%":/legrande-cypress -t cypress-image:latest --spec cypress/integration/examples/*.js it will throwes an error below.
Your pluginsFile threw an error from: /legrande-cypress/cypress/plugins/index.js
Error: Cannot find module 'cypress-mochawesome-reporter/plugin'
Require stack:
- /legrande-cypress/cypress/plugins/index.js
- /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js
- /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at module.exports (/legrande-cypress/cypress/plugins/index.js:22:3)
at /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:94:12
at tryCatcher (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
at load (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:91:7)
at EventEmitter.<anonymous> (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:209:5)
at EventEmitter.emit (events.js:400:28)
at process.<anonymous> (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
at process.emit (events.js:400:28)
at emit (internal/child_process.js:912:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
How to resolve this error please let me know if anyone has any idea.
I have the following function that is trying to load a .ejs file with the following path.
function PaintNewOpponent() {
ejs.renderFile('views/NewOpponent.ejs', {pPlayer:pPlayerLocal}, function(err, str) {
$("#AddPlayerDialog").html(str);
alert(err)
RenderEvents();
FillInModalinformation()
});
}
I have run an alert check with __dirname and have discovered that I am in the correct directory. Here is a screenshot of my explorer window from Visual Studio Code.
the directory html is in my root directory. __dirname returns that I am in /html/js. PaintNewOpponent() is inside my NewOpponent.js file. Yet the ejs.renderFile call comes back in error saying it cannot file the file. Everything is in place.
If necessary here is package.json file
{
"name": "combattracker",
"version": "3.0.0",
"description": "AutoHARP 3: Combat Tracker",
"main": "index.js",
"license": "ISC",
"scripts": {
"start": "electron .",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"package-win": "electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"AutoHARP 3\"",
"package-linux": "electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds"
},
"author": "David Klecker",
"dependencies": {
"bootstrap": "^4.5.2",
"bootstrap-sass": "^3.4.1",
"commonjs": "0.0.1",
"ejs": "^3.1.5",
"electron": "^10.1.2",
"electron-alert": "^0.1.11",
"electron-reload": "^1.5.0",
"embed-js": "^5.0.4",
"jquery": "^3.5.1",
"parser": "^0.1.4",
"popper.js": "^1.16.1",
"uniter": "^2.16.0",
"xml2js": "^0.4.23",
"xmlbuilder": "^15.1.1"
},
"devDependencies": {
"electron-packager": "^15.1.0"
}
}
I don't know if this will help but what I do is to build an absolute path using the path library (actually I use upath for cross platform compatibility because I often need to save the path to a file).
const iconPath = upath.joinSafe(__dirname, 'app', 'assets', 'win_icon_64x64.png');
I'm getting the following error whenever I try to run my app:
My package.json:
{
"name": "SteamCMD-GUI",
"productName": "SteamCMD GUI",
"version": "0.0.1",
"main": "main.js",
"author": "avi12",
"scripts": {
"start": "electron .",
"package": "asar pack \"SteamCMD GUI-win32-x64\" \"SteamCMD GUI.asar\"",
"build-windows": "electron-packager . --platform=win32 --overwrite --out=release-builds --prune=true --icon=image/icon.ico --asar",
"build-linux": "electron-packager . --platform=linux --overwrite --out=release-builds --prune=true --icon=image/icon.png --asar",
"build-mac": "electron-packager . --platform=darwin --overwrite --out=release-builds --prune=true --icon=image/icon.icns --asar"
},
"dependencies": {
"bignumber.js": "^5.0.0",
"chokidar": "^1.7.0",
"decompress": "^4.2.0",
"electron": "^1.8.4",
"electron-dl": "^1.11.0",
"fs-jetpack": "^1.3.0",
"jquery": "^3.3.1",
"node-fetch": "^1.7.3",
"onsenui": "^2.9.2",
"sudo-prompt": "^7.1.1",
"tooltip.js": "^1.2.0"
}
}
How can I solve this?
Searching for that error led me here, which suggests that it's a problem in libuv, an IO library used by Node. This issue is fixed in a later version of libuv, which is used by a later version of Node, which is used by a later version of Electron.
Updating to Electron 2.0 solves this issue.
I create desktop application by using electron, and tried electron-packager.
But electron-packager doesn't package node modules which names are started from "#" (Example: #turf, #mapbox)
In node_modules folder of developing folder, I can find "#turf" and "#mapbox".
But after running
>electron-packager . MaplatEditor --platform=darwin --arch=x64 --electron-version=1.7.9
Created package never includes "#turf" and "#mapbox".
And also, it's depending modules are also not included.
My package.json includes "#turf", so it is not setting error.
{
"name": "MaplatEditor",
"version": "1.0.0",
"description": "",
"main": "lib/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#turf/turf": "^4.6.1",
"argv": "0.0.2",
"async": "^2.5.0",
"child_process": "^1.0.2",
"electron-json-storage": "^3.2.0",
"file-url": "^2.0.2",
"fs-extra": "^3.0.1",
"imagemagick": "^0.1.3",
"mapshaper": "^0.4.31",
"path": "^0.12.7",
"wellknown": "^0.5.0"
}
}
How can I package such #-started modules into application package?
In my case, I updated #Turf module for latest version, then electron-packager worked well.
I don't know why, but it looks not the issue of electron-packager...
I have created a sample Electron App and i need to create a .exe file from it. I managed to build the app without errors but when i start the app an error appears.I cant figure out why im getting this.How to resolve this?.
The Error im getting
My package.json file
{
"name": "wordsum",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron main.js",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=App/assets/WSlogo.icns --prune=true --out=release-builds",
"build": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=App/assets/WSlogo.ico --prune=true --out=release-builds --version-string.CompanyName=DevX --version-string.FileDescription=DevX --version-string.ProductName=\"WordSum\"",
"package-linux": "electron-packager . --overwrite --platform=linux --arch=x64 --icon=App/assets/WSlogo.png --prune=true --out=release-builds"
},
"author": "Thaaraka Romesh",
"license": "MIT",
"dependencies": {
"angular": "^1.6.2",
"bootstrap": "^3.3.7",
"jquery": "^3.1.1"
},
"devDependencies": {
"electron": "^1.4.15",
"electron-packager": "^8.5.1"
}
}
The Repo of the project Electron project
I found out whats wrong. In my package.json file its mentioned as "main": "index.js" but im my app the actual main file is called main.js.