Please install sqlite3 package manually after electron-packager on linux for windows - node.js

I am trying to package my app with electron-packager. My app have as dependencies sqlite3 and sequelize.
here is my package.json file :
{
"name": "electronjs_base",
"version": "1.0.0",
"description": "Projet de base Electron JS",
"main": "main.js",
"scripts": {
"start": "electron main.js",
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "install-app-deps",
"rebuild": "electron-rebuild -f -w sqlite3"
},
"author": "Aurélien Colombet & Steven Servanton",
"license": "ISC",
"devDependencies": {
"electron": "^4.0.3",
"electron-builder": "^20.38.5",
"electron-packager": "^13.0.1",
"electron-rebuild": "^1.8.2"
},
"dependencies": {
"cors": "^2.8.5",
"ejs": "^2.6.1",
"electron-reload": "^1.4.0",
"express": "^4.16.4",
"formidable": "^1.2.1",
"fs": "0.0.1-security",
"path": "^0.12.7",
"sequelize": "^4.42.0",
"sqlite3": "^4.0.6"
}
}
I am on linux and I am trying to build my app for windows. I use electron-packager for that, with that command :
electron-packager . gamemaster_interface --overwrite --platform=win32 --arch=x64 --out=release-builds
My app works well on linux when I launch it with npm run start, but when I am trying to run it on windows with the executable file created by electron-packager I have a javascript error :
I don't know how to solve that problem, I have trying multiple things like adding sqlite3 in devDependencies instead of dependencies in the package.json but I still have the error.
Thank you for reading me and I hope someone have the solution :).
Have a nice day !

Related

Error during uploading mern stack project into heroku

In Procfile:
web: node Backend/server.js
In package.json of backend, I am using post build for react app. its saying cannot find module /app/backend/server.js.
{
"name": "ecommerce",
"version": "1.0.0",
"description": "",
"main": "Backend/server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node backend/server.js",
"dev": "nodemon backend/server.js",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false && npm install --prefix frontend && npm run build --prefix frontend"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cloudinary": "^1.28.1",
"cookie-parser": "^1.4.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"express-fileupload": "^1.2.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.0.10",
"nodemailer": "^6.7.0",
"nodemon": "^2.0.13",
"stripe": "^8.197.0",
"validator": "^13.6.0"
}
}
My project is laid out like this:
Backend/
frontend/
Procfile
package-lock.json
package.json
Your start script tries to run node backend/server.js, but your file is actually at Backend/server.js. Heroku's filesystem is case-sensitive. You can use either option, but you must be consistent.
Here is one solution. Rename your directory:
git mv Backend backend
And update your Procfile:
web: node backend/server.js
Then commit and redeploy.

NPM version discrepancy between main version and cpanel version

When running npm-version on my local server/laptop I receive 7.5.6
However, when running on cpanel terminal -- I receive
[~]# /opt/cpanel/ea-nodejs10/bin/npm --version
6.14.11
And this 6.14.11 is after I ran
[~]# /opt/cpanel/ea-nodejs10/bin/npm install --latest version -g
Which I thought would update it to the 7.5.6 as I used the same command to update the one on my computer as well.
In all I'm having trouble deploying my webapp on bluehost via cpanel. Even though the app is registered with the application manager -- and the Ensure Dependencies part came out done and successful. And the git repo is cloned and deployed with no errors.
Would this discrepancy be causing the app not to launch?
I can't understand why it isn't deploying properly, so I was thinking there may be something with the package.json or (package-lock.json) -- ei - could the versions in such bet preventing deployment due to discrepancies.
Would love some help, been trying to get this deployed for days!
my package.json
{
"name": "vandenbergdevelopment",
"version": "1.0.0",
"description": "DeltaDesignServer",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "J Vandenberg",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"firebase-tools": "^9.5.0",
"hover.css": "^2.3.2",
"nodemailer": "^6.4.18",
"nodemailer-mailgun-transport": "^2.0.2",
"version": "^0.0.4"
}
}
The top bit to the lock.json
"": {
"name": "vandenbergdevelopment",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"version": "^0.0.4",
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"firebase-tools": "^9.5.0",
"hover.css": "^2.3.2",
"nodemailer": "^6.4.18",
"nodemailer-mailgun-transport": "^2.0.2"
}
},
Thank you!

Deploy to Node App Azure App Service tsc not recognized as command

I am trying to deploy a nodejs app onto Azure App Service. I did the basics of deploying it, but it's failing to run. It seems it is designed to run "node run.js" commands rather than "npm run start".
I'm playing in the console, and if I try to run npm run start manually, I get a series of errors tied to build. Basically:
'tsc' is not recognized as an internal or external command
I'm wondering if there's something really obvious here about how tsc (and others) can be added to path. I have to admit, I'm not particularly well versed in using Azure or Node for that matter. Any help would be very much appreciated! Thanks!
This is the package.json file:
{
"name": "test-scraper",
"version": "0.1.1",
"description": "",
"main": "dist/main.js",
"scripts": {
"build": "tsc",
"build:dev": "tsc --watch",
"prestart": "npm run build",
"start:dev": "nodemon",
"start": "pm2 start dist/src/main.js --node-args=\"-r ./tsconfig-paths-bootstrap.js\" && pm2 monit",
"stop": "pm2 delete main"
},
"author": "",
"license": "MIT",
"devDependencies": {
"#types/lodash": "^4.14.161",
"#types/node": "^14.11.8",
"#types/puppeteer": "^3.0.2",
"nodemon": "^2.0.4",
"prettier": "^2.1.2",
"typescript": "^4.0.3"
},
"dependencies": {
"axios": "^0.20.0",
"discord-webhook-node": "^1.1.8",
"lodash": "^4.17.20",
"messaging-api-telegram": "^1.0.1",
"playwright-firefox": "^1.4.2",
"pm2": "^4.5.0",
"tsconfig-paths": "^3.9.0",
"winston": "^3.3.3"
}
}
Run this command locally for installing typescript, because your code is compiled with the tsc command.
npm install -g typescript
Mostly I was following this tutorial.
Add the tsc command to package.json and add the dependencies:
"build": "tsc --project ./"
...
"devDependencies": {
"#types/express": "^4.17.9",
"#types/node": "^14.14.20",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
},
Here is my file structure:
I add a empty file.ts and add this scripts to the tsconfig.jason file:
"exclude": [ "src", "wwwroot" ],
"include": [ "file.ts" ]
Deploy through Azure Web App deployment center:
And the app build (tsc) run successfully:
if you are deploying to Production (NODE_ENV: production), devDependencies will no longer being installed, and you need to edit your package.json and move typescript to dependencies.
Source

Build node.js app using yarn but getting error Command "build" not found

This is my package.json file.
{
"name": "moneymall",
"version": "1.0.0",
"description": "A money mall server app.",
"main": "index.js",
"author": "Anbu Selvan",
"license": "ISC",
"keywords": [],
"dependencies": {
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"e": "0.0.4",
"express": "^4.16.4",
"mysql": "^2.16.0",
"pug": "^2.0.3",
"yarn": "^1.15.2"
},
"devDependencies": {
"nodemon": "^1.18.10",
"react-scripts": "^2.1.8"
}
}
Run yarn build and get this error.
yarn run v1.15.2 error Command "build" not found. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command
You don't seem to have a script.build key defined in your package.json file. Sample entry for building with webpack library would be:
"scripts": {
"build": "webpack"
}
If you execute yarn run it will show the list of commands which can be run.
Ideally yarn run dev will do the trick of compiling the build
Please re-read the yarn documentation. You don't seem to have a script key declaring what you build script is, and thus Yarn does not know what to load.

GatsbyJS blog not compiling anymore after "npm update"?

If it's a Gatsby, webpack or npm issue i don't understand yet.
I did these commands in terminal and they seem to have started the issue, trying to fix a material-ui "Popper" module that had a "could not find module" error.
npm install react-popper#next --save
npm install avj
npm install --save-dev webpack
npm install & npm update
Terminal:
error There was a problem loading the local develop command. Gatsby
may not be installed. Perhaps you need to run "npm install"?
Error: Cannot find module 'webpack/lib/removeAndDo'
package.json
{
"name": "auto-club-reviews",
"description": "Auto Club Reviews Blog",
"version": "1.0.0",
"author": "Sofianu Alin",
"dependencies": {
"#material-ui/core": "^1.4.3",
"#material-ui/icons": "^1.1.0",
"gatsby": "^1.9.277",
"gatsby-link": "^1.6.46",
"gatsby-plugin-feed": "^1.3.25",
"gatsby-plugin-google-analytics": "^1.0.31",
"gatsby-plugin-offline": "^1.0.18",
"gatsby-plugin-react-helmet": "^2.0.11",
"gatsby-plugin-react-next": "^1.0.11",
"gatsby-plugin-sharp": "^1.6.48",
"gatsby-plugin-typography": "^1.7.19",
"gatsby-remark-copy-linked-files": "^1.5.37",
"gatsby-remark-images": "^1.5.67",
"gatsby-remark-responsive-iframe": "^1.4.20",
"gatsby-remark-smartypants": "^1.4.12",
"gatsby-source-contentful": "^1.3.54",
"gatsby-source-filesystem": "^1.5.39",
"gatsby-transformer-remark": "^1.7.44",
"gatsby-transformer-sharp": "^1.6.27",
"lodash": "^4.17.10",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-helmet": "^5.2.0",
"react-hover": "^1.3.2",
"react-popper": "^1.0.2",
"typeface-roboto": "0.0.54"
},
"devDependencies": {
"eslint": "^5.3.0",
"eslint-plugin-react": "^7.10.0",
"gh-pages": "^1.2.0",
"html-webpack-plugin": "^3.2.0",
"prettier": "^1.14.2",
"webpack": "^4.16.5",
"webpack-command": "^0.4.1",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-server": "^3.1.5"
},
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
"keywords": [
"gatsby"
],
"license": "MIT",
"main": "n/a",
"repository": {
"type": "git",
"url": "git+https://github.com/gatsbyjs/gatsby-starter-blog.git"
},
"scripts": {
"dev": "gatsby develop",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js' 'src/**/*.md'",
"develop": "gatsby develop",
"build": "gatsby build",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
}
}
Also tried to:
delete node_modules then npm install;
uninstall "webpack-cli": "^3.1.0" and install webpack-commander;
uninstall extract-text-webpack-plugin that seemed to be complained about in terminal;
Any ideas comrades?
Have you been experimenting with Gatsby v2? Your package.json shows React v16, which is a peerDependency of Gatsby v2, but not of Gatsby v1. In Gatsby v1 (which is what you have in package.json) you should not install React directly, it's installed as a dependency of Gatsby.
Webpack is also (both v1 and v2) a dependency of Gatsby. I don't think you should have it in package.json as a top level dependency.
I would recommend starting with a clean Gatsby starter, then copying your gatsby-node.js, gatsby-config.js, components, content, etc, into that project. Leave the package.json file. Then run npm install --save for every package that you explicitly import or require. Hopefully that gets you back to a working site.
Sidenote, personally, I would also recommend yarn over npm.
Gatsby clean-cache
Then delete node modules
and then
yarn start/npm install

Resources