Dependencies aren't being included on the build output of electron forge - build

My electron app project uses create-react-app and my main process needed the electron-devtools-installer module. I'm using electron-forge for building the app. Now after running npm run make to package and built the app, I'm getting this error message
Error: Cannot find module 'electron-devtools-installer'
after opening the app. I'm not getting this error when I simply run electron ., thus I suspect the module is not being included on the packaging.
Now the said module is for development only, I could simply write a logic to ignore it when in production mode but what happens when I really need a 3rd party modules in my main process in the production, so how do I include the dependencies modules in the packaging?
I moved the electron-devtools-installer mode in dependencies key in package.json but it still doesn't work.
My package.json contains:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"homepage": ".",
"description": "some description",
"main": "main/init.js",
"author": "anonymouse",
"license": "MIT",
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"electron-devtools-installer": "^3.2.0",
"electron-squirrel-startup": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "electron-forge start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"dev": "concurrently -k \"react-scripts start\" \"npm:electron\"",
"electron": "wait-on tcp:3000 && electron .",
"package": "react-scripts build && electron-forge package",
"make": "react-scripts build && electron-forge make",
"clean:winbuild": "rmdir build /s /q & rmdir out /s /q"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#electron-forge/cli": "^6.0.0-beta.67",
"#electron-forge/maker-deb": "^6.0.0-beta.67",
"#electron-forge/maker-rpm": "^6.0.0-beta.67",
"#electron-forge/maker-squirrel": "^6.0.0-beta.67",
"#electron-forge/maker-zip": "^6.0.0-beta.67",
"concurrently": "^7.4.0",
"dotenv": "^16.0.3",
"electron": "^21.1.1",
"eslint": "^8.25.0",
"eslint-config-google": "^0.14.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.3.0",
"eslint-plugin-promise": "^6.1.0",
"eslint-plugin-react": "^7.31.10",
"wait-on": "^6.0.1"
},
"config": {
"forge": "./forge.config.js"
}
}
My forge.config.js:
module.exports = {
packagerConfig: {
ignore: [
/coverage.*/,
/node_modules.*/,
/public.*/,
/src.*/,
/\.env|\.gitignore|.*bak|eslint.*|package-lock.*|(?<!build.*)\.txt|(?<!build.*)\.md/
]
},
makers: [
{
name: '#electron-forge/maker-squirrel',
config: {
name: 'bkkgapp'
}
},
{
name: '#electron-forge/maker-zip'
}
]
}

Related

trying to run npm start but getting a port error message

when i'm trying to run "npm start" i'm getting this error message Port "1234" could not be used
enter image description here
see my packege.json
{
"name": "simplefolio",
"version": "1.0.1",
"private": "true",
"description": "A clean, beautiful and responsive portfolio template for Developers!",
"source": "src/index.html",
"scripts": {
"start": "parcel",
"build": "parcel build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cobidev/simplefolio"
},
"keywords": [],
"author": "Jacobo Martinez",
"license": "ISC",
"bugs": {
"url": "https://github.com/cobidev/simplefolio/issues"
},
"homepage": "https://github.com/cobidev/simplefolio#readme",
"devDependencies": {
"#parcel/transformer-sass": "^2.0.1",
"parcel": "^2.0.1",
"prettier": "^2.4.1"
},
"dependencies": {
"#popperjs/core": "^2.10.2",
"bootstrap": "^5.1.3",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"vanilla-tilt": "^1.7.2"
}
}
Do you have VLC running on your computer? It might be using that port: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
Can you try to use a different port?

How to use vue development mode with Django

I don't know how to run development mode with Django. I'm running webpack and when I finish all the Vuejs work I just bundle all to a folder where Django serves It as a static file. I know taht I've to run webpack with mode development but that doens't work, It gives me a cannot found error.
I'd like to run Vuejs in development mode alongside with Django, how can I do that?
I'll share to you my project structure, my package.json and webpack config.
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
entry: './frontend/Vue/main.js',
output: {
filename: 'build.js',
path: path.resolve(__dirname, './static/js'),
publicPath: '/static/js'
},
module: {
rules: [
{
test: /\.(js)$/,
exclude: /(node_modules)/,
use: [
{ loader: 'babel-loader' }
]
},
{
test: /\.(css|scss)/,
use: [
'style-loader'
]
},
{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader'
}
]
},
devServer: {
// contentBase: ponerle la ruta del index de django
contentBase: path.join(__dirname, 'templates'),
watchContentBase: true,
historyApiFallback: true,
noInfo: true
},
plugins: [
new VueLoaderPlugin()
]
}
package.json
{
"name": "TuDistribuidora",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --mode development --port 9000 --open",
"build": "webpack --progress"
},
"repository": {
"type": "git",
"url": "git+https://github.com/EmiBuffet/TuDistribuidora.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/EmiBuffet/TuDistribuidora/issues"
},
"homepage": "https://github.com/EmiBuffet/TuDistribuidora#readme",
"dependencies": {
"vue": "^2.6.11",
"vue-router": "^3.4.5",
"vuex": "^3.5.1"
},
"devDependencies": {
"#babel/core": "^7.11.1",
"babel-loader": "^8.1.0",
"babel-preset-es2015": "^6.24.1",
"node-sass": "^4.14.1",
"sass-loader": "^9.0.3",
"style-loader": "^1.2.1",
"vue-loader": "^15.9.3",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"bulma": "^0.9.1"
}
}
project structure:
Using django-webpack-loader in your Django project in combination with webpack-bundle-tracker in your webpack build will provide the connection needed to alternate between production/dev Vue builds quickly. The bundle information will be recorded by webpack into a webpack-stats.json which will then be used by Django to fetch/load the correct bundles for a given view.
I have an article explaining step-by-step how to set up a project with the above techniques.
Good hacking!

Netlify deploy issue on build

site link - https://react-chat-page.netlify.app/
github - https://github.com/mrshawnhum/chat-app
I have recently added a redirect file to fix a bug when you refresh the site and I added automatic deploys with netlify-cli to my project. The first time I added Yarn Run Build and received an exit code 127 when attempting to deploy. I manually changed it on netlify to Yarn Build and still receive the same message. I also attempted to clear the cache and manually deploy the site and still receive the same message.
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.3.2",
"#testing-library/user-event": "^7.1.2",
"font-awesome": "^4.7.0",
"netlify-cli": "^2.58.0",
"query-string": "^6.13.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-emoji": "^0.5.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-scroll-to-bottom": "^3.0.0",
"socket.io-client": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"postbuild": "cp_redirects ./build/",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Netlify will start the build from the root folder of your git repo by default, which doesn't have your package.json file in it, and so Netlify doesn't know how to run yarn.
You can change that in the UI settings, see here.

Jest test are failing

Below is issue am getting when I try to run the jest command.
jest --config jest.config.json
FAIL test\Home.spec.js
? Test suite failed to run
SyntaxError: Unexpected reserved word at transformAndBuildScript(node_modules\jest\node_modules\jest-cli\node_modules\jest-runtime\build\transform.js:320:12)
Below is my configuration. Package.json with webpack, jest versions
{
"name": "testjest",
"version": "1.0.0",
"description": "Test React and Redux using Jest",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "webpack-dev-server --content-base --inline --hot",
"test": "jest --config jest.config.json"
},
"dependencies": {
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-redux": "^5.0.1",
"redux": "^3.6.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-jest": "^21.2.0",
"babel-loader": "^6.2.10",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"core-js": "^2.4.0",
"enzyme": "^2.7.0",
"jest": "^18.1.0",
"json-stable-stringify": "^1.0.1",
"react-addons-test-utils": "^15.4.1",
"react-test-renderer": "^15.4.1",
"redux-mock-store": "^1.2.1",
"regenerator-runtime": "^0.11.0",
"regenerator-transform": "^0.10.0",
"identity-obj-proxy": "3.0.0",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2"
}
}
Here is my jest json config file.
{
"moduleFileExtensions": [
"js",
"jsx"
],
"moduleDirectories": ["node_modules", "bower_components", "shared"],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
},
"testPathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/legacy_notes_and_workbook/",
"<rootDir>/src/stylesheets/"
],
"transform": {},
"transformIgnorePatterns": [ "<roodDir>/node_modules/(?!)" , "node_modules/(?!(jest-)?react-native|react-navigation)" ],
"testRegex": "(/__tests__/.*|\\.?(test|spec|Test|Spec))\\.(ts|tsx|js|jsx)$"
}
Node versions installed on my machine are:
node -v
v4.2.2
npm -v
1.4.28
Please let me know if anybody has any solution on above issue. Thanks in advance.

parse server deploying to aws

I am trying to deploy deploy my parse server, parse server dashboard, etc to aws. I am sure that the problem that I am experiencing is quite simple and it has to do with how I am packaging my ab node apps. I am downloading the git repo and then uploading the zip to my eb instance. It is in turn giving me this error.
After downloading a repository, such as parse server, what do I need to do to put it on elastic bean stalk? I already have the parse server example running on aws. I am just trying to upgrade versions.
here is my package.JSON file
{
"name": "parse-server",
"version": "2.2.16",
"description": "An express module providing a Parse-compatible API server",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server"
},
"files": [
"bin/",
"src/",
"public_html/",
"views/",
"LICENSE",
"PATENTS",
"README.md"
],
"license": "BSD-3-Clause",
"dependencies": {
"babel-polyfill": "6.8.0",
"babel-runtime": "6.6.1",
"bcrypt-nodejs": "0.0.3",
"body-parser": "1.15.2",
"colors": "1.1.2",
"commander": "2.9.0",
"deepcopy": "0.6.3",
"express": "4.14.0",
"intersect": "1.0.1",
"lodash": "4.12.0",
"lru-cache": "4.0.1",
"mailgun-js": "0.7.10",
"mime": "1.3.4",
"mongodb": "2.1.18",
"multer": "1.1.0",
"parse": "1.9.0",
"parse-server-fs-adapter": "1.0.0",
"parse-server-push-adapter": "1.0.4",
"parse-server-s3-adapter": "1.0.4",
"parse-server-simple-mailgun-adapter": "1.0.0",
"pg-promise": "5.2.0",
"redis": "2.6.2",
"request": "2.73.0",
"request-promise": "4.0.1",
"semver": "^5.2.0",
"tv4": "1.2.7",
"winston": "2.2.0",
"winston-daily-rotate-file": "1.1.5",
"ws": "1.1.1"
},
"devDependencies": {
"babel-cli": "6.8.0",
"babel-core": "6.10.4",
"babel-istanbul": "0.11.0",
"babel-plugin-syntax-flow": "6.8.0",
"babel-plugin-transform-flow-strip-types": "6.8.0",
"babel-preset-es2015": "6.6.0",
"babel-preset-stage-0": "6.5.0",
"babel-register": "6.8.0",
"codecov": "1.0.1",
"cross-env": "2.0.0",
"deep-diff": "0.3.4",
"gaze": "1.1.0",
"jasmine": "2.4.1",
"mongodb-runner": "3.3.2",
"nodemon": "1.9.2"
},
"scripts": {
"dev": "npm run build && node bin/dev",
"build": "./node_modules/.bin/babel src/ -d lib/",
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 ./node_modules/.bin/mongodb-runner start",
"test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
"test:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/** ./node_modules/jasmine/bin/jasmine.js && npm run posttest",
"posttest": "./node_modules/.bin/mongodb-runner stop",
"coverage": "cross-env COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' npm test",
"start": "node ./bin/parse-server",
"prepublish": "npm run build"
},
"engines": {
"node": ">=4.3"
},
"bin": {
"parse-server": "./bin/parse-server"
}
}
You have to physically go into the repository and compress it into a new zip file. For some reason it would not accept zip files that I downloaded off of github.