Electron Js - A javascript error occurred in the main process - javascript

I have created an electron project which is working fine but when I try to package an electron app using electron packager and then run it. I am facing an exception
Uncaught Exception:
Error: Cannot find module
Require stack
'E:\app-folder..release-builds\app-win32-ia32\resources\app....\node_sqlite3.node'
click here to see Error
'Here is my package.json'
{
"name": "app",
"version": "1.0.0",
"main": "main.js",
"devDependencies": {
"electron": "^8.2.0",
"electron-builder": "^22.8.0",
"electron-rebuild": "^1.10.1"
},
"scripts": {
"start": "electron .",
"rebuild": "electron-rebuild -f -w sqlite3",
"package-win": "electron-packager . App--overwrite --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=\"App\"",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"axios": "^0.19.2",
"concat-stream": "^2.0.0",
"datatables.net": "^1.10.20",
"datatables.net-dt": "^1.10.20",
"ejs": "^3.1.5",
"electron-packager": "^15.0.0",
"express-validator": "^6.6.1",
"form-data": "^3.0.0",
"jquery": "^3.5.0",
"nodemailer": "^6.4.11",
"sqlite3": "^5.0.0"
}
}

npm install --save-dev #electron-forge/cli
npm run package
try running these commands you will get an out folder and the application is present in that out folder

Related

Unable to execute run build in boilerplate?

I tried to enter yarn run build in boilerplate.
but it shows warning/error
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in main
Module not found: Error: Can't resolve './src' in 'C:\Users\0110\Documents\boilerplate-mern-stack-master'
resolve './src' in 'C:\Users\0110\Documents\boilerplate-mern-stack-master'
using description file: C:\Users\0110\Documents\boilerplate-mern-stack-master\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: C:\Users\0110\Documents\boilerplate-mern-stack-master\package.json (relative path: ./src)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\0110\Documents\boilerplate-mern-stack-master\src doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\0110\Documents\boilerplate-mern-stack-master\src.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
C:\Users\0110\Documents\boilerplate-mern-stack-master\src.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
C:\Users\0110\Documents\boilerplate-mern-stack-master\src.wasm doesn't exist
as directory
C:\Users\0110\Documents\boilerplate-mern-stack-master\src doesn't exist
webpack 5.74.0 compiled with 1 error and 1 warning in 494 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
There is an error in ./src, but I don't know what this means.
This is my package.json
{
"name": "react-boiler-plate",
"version": "1.0.0",
"description": "react boiler plate",
"main": "index.js",
"engine": {
"node": "10.16.0",
"npm": "6.9.0"
},
"scripts": {
"start": "node server/index.js",
"build": "webpack",
"backend": "nodemon server/index.js",
"frontend": "npm run start --prefix client",
"dev": "concurrently \"npm run backend\" \"npm run start --prefix client\"",
"predeploy": "yarn build",
"deploy": "gh-pages -d build"
},
"dependencies": {
"async": "^3.2.0",
"bcrypt": "^5.0.1",
"body-parser": "^1.18.3",
"cookie-parser": "^1.4.3",
"cors": "^2.8.5",
"debug": "^4.1.1",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"moment": "^2.24.0",
"mongoose": "^5.4.20",
"multer": "^1.4.2",
"react-redux": "^5.0.7",
"saslprep": "^1.0.3",
"supports-color": "^7.1.0",
"webpack": "^5.74.0"
},
"devDependencies": {
"concurrently": "^4.1.0",
"gh-pages": "^4.0.0",
"nodemon": "^1.19.1",
"webpack-cli": "^4.10.0"
}
}
I used both yarn and npm but it still didn't work
I don't know why I can't run build only for this project.
This is my first time using boilerplate.

Why babel-node "Cannot find module" without ".js" extension?

I dont know why babel-node does not import without ".js" extension.
I have "type": "module" in package.js
import example from "./src/example.js"; works fine
import example from "./src/example"; doesnt work
--es-module-specifier-resolution=node works only when I dont use babel-node
package.js
"type": "module",
"scripts": {
"start": "node ./index.js --exec babel-node -e js --experimental-modules --es-module-specifier-resolution=node "
},
"dependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.20.0",
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.3.5",
"nodemon": "^2.0.16",
"npm": "^8.12.1"
},
"devDependencies": {
"#babel/cli": "^7.17.10",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1"
}
npm install #babel/node solved my problem

Can someone explain how I can add and use 'electron-auto-updater' to my electron app

I'm currently trying to figure out how to add an auto-updater to my electron app so I don't have to keep updating my google drive link for the app.
I've seen some videos but none really explain how to setup your package.json or how to get a .git file etc.
Currently, my package.json looks like this:
{
"name": "notify",
"version": "1.0.0",
"description": "A prototype version of Notify",
"main": "./Javascript/Main.js",
"dependencies": {
"electron": "^11.2.0",
"electron-is-dev": "^1.2.0",
"electron-log": "^4.3.1",
"electron-packager": "^15.2.0",
"electron-updater": "^4.3.5",
"update-electron-app": "^2.0.1",
"ws": "^7.4.2"
},
"devDependencies": {
"concurrently": "^5.3.0",
"electron": "^11.2.0",
"electron-packager": "^15.2.0",
"npm-run-all": "^4.1.5"
},
"scripts": {
"start": "electron .",
"dev": "concurrently --kill-others \"electron .\" \"electron .\"",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=release-builds",
"package-win": "electron-packager . Notify --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Notify\"",
"package-linux": "electron-packager . Notify --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds"
},
"author": "",
"license": "ISC"
}
I want to set up my package.json for windows devices (preferably others too but mainly windows).
If anyone has any videos / links on how to use the electron-auto-updater with ease please link them aswell. Thank you in advance.

Ember Quickstart tutorial: Parsing error: Unexpected character '#' in '#action'

I just started using Ember and I have some trouble with the Ember Quickstart tutorial. Currently, I get Parsing error: Unexpected character '#' in line 5 of people-list.js:
import Component from '#glimmer/component';
import { action } from '#ember/object';
export default class PeopleListComponent extends Component {
#action
showPerson(person) {
alert(`The person's name is ${person}!`);
}
}
What's wrong here? The code is copied from the tutorial.
This is the output of ember -v:
ember-cli: 3.18.0
node: 11.13.0
os: darwin x64
This is my package.json. I can run npm install, but yarn install gives me The engine "node" is incompatible with this module. Expected version "10.* || >= 12". Got "11.13.0".
{
"name": "ember-quickstart",
"version": "0.0.0",
"private": true,
"description": "Small description for ember-quickstart goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test"
},
"devDependencies": {
"#ember/jquery": "^0.5.2",
"#ember/optional-features": "^0.6.3",
"broccoli-asset-rev": "^2.7.0",
"ember-ajax": "^5.0.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.1.2",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^4.2.3",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-uglify": "^2.1.0",
"ember-data": "~3.9.0",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.1.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^3.4.1",
"ember-resolver": "^5.0.1",
"ember-source": "~3.9.0",
"ember-welcome-page": "^3.2.0",
"eslint-plugin-ember": "^5.2.0",
"loader.js": "^4.7.0",
"qunit-dom": "^0.8.0"
},
"engines": {
"node": "10.* || >= 12"
},
"dependencies": {
"ember-cli": "^3.18.0",
"#glimmer/component": "^1.0.0"
}
}
Adding some text here as SO won't let me post the question otherwise.
You're ember-source is set to ~3.9.0. I'm pretty sure #action is an Octane feature that was added in 3.14.
Either update ember-source to 3.14 or newer or switch to the 3.9.0 documentation. I'd recommend updating as Octane is awesome.
The output says you currently have ember-cli 3.18, but your app seems to have been generated by an older ember-cli 3.9 as indicated by devDependencies.
As mentioned in the comments, 3.9 does not have access to some of the current features unless you install some polyfills.
If regenerating the app is a possibility, I would suggest doing it.
Run ember --version to make sure 3.18 is being called
Run ember new my-app-name and check that package.json has 3.18 for ember-source.
Go through the quickstart!
Alternatively, you can run npx ember-cli new my-app-name and it should generate an app using the latest ember-cli version available in npm.
If you don't want to lose some work you might have done, you can check out ember-cli-update by running something like npx ember-cli-update. Check the README for more info.

"Cannot GET /" error when deploying Nuxt Vue.js application to Google App Engine

I get a "500 Server Error" when I deploy my Nuxt application.
Below are my configuration files:
package.json
{
"name": "my-app-name",
"version": "1.0.0",
"description": "An App",
"author": "Me",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "NODE_ENV=production nuxt",
"deploy": "npm run build && gcloud app deploy",
"generate": "nuxt generate",
"postinstall": "nuxt build"
},
"dependencies": {
"#nuxtjs/axios": "^5.0.0",
"#firebase/firestore": "^0.6.0",
"#firebase/storage": "^0.2.3",
"firebase": "^5.3.0",
"nuxt": "^1.0.0",
"nuxt-buefy": "^0.0.4"
},
"devDependencies": {
"cross-env": "^5.0.1",
"node-sass": "^4.9.2",
"nuxt-sass-resources-loader": "^2.0.3",
"sass-loader": "^7.0.3"
}
}
Previously my start was nuxt start and i do not have deploy
https://github.com/kamatte-me/nuxt-gae-se/blob/master/package.json
But still get the same error.
app.yaml
runtime: nodejs8
env : standard
I also referred and attempted to try out the suggestions here and here but doesn't work. Note that my application does not have a server.js or app.js, so i cannot use those.
Update
I did a workaround using the below approach (so can ignore everything above unless you need it as additional reference).
I added a server.js (exactly same as theirs) following https://github.com/kamatte-me/nuxt-gae-se and updated my package.json to such:
{
"name": "my-app-name",
"version": "1.0.0",
"description": "A App",
"author": "Me",
"private": true,
"scripts": {
"dev": "node server.js",
"build": "nuxt build",
"start": "NODE_ENV=production node server.js",
"deploy": "npm run build && gcloud app deploy",
"generate": "nuxt generate",
"postinstall": "nuxt build"
},
"dependencies": {
"#nuxtjs/axios": "^5.0.0",
"#firebase/firestore": "^0.6.0",
"#firebase/storage": "^0.2.3",
"express": "^4.16.3", //<-added this as suggested by kamette
"firebase": "^5.3.0",
"nuxt": "^1.0.0",
"nuxt-buefy": "^0.0.4"
},
"devDependencies": {
"cross-env": "^5.0.1",
"node-sass": "^4.9.2",
"nuxt-sass-resources-loader": "^2.0.3",
"sass-loader": "^7.0.3"
}
}
Now my error is this:
Any idea?
I have this in my Navigation.vue:
<nuxt-link to="/" exact>Dashboard</nuxt-link>
In addition, the error logs I saw:
After adding "nuxt-sass-resources-loader": "^2.0.3" to the dependencies as advised by kamatte, I am seeing back the "500 Server Error" again, logs doesn't show anything useful (I have clicked "Load newer logs" many times already, this is the latest...)
Express.js and nuxt-sass-resources-loader must be included in package.json.
.e.g.)
package.json
"dependencies": {
"express": "^4.16.3",
"nuxt-sass-resources-loader": "^2.0.3"
},
Otherwise, Express.js will not be installed on the GAE.
It seems that it worked because you already installed Express.js in your local environment.

Categories

Resources