This week I got into electron and I have built my own simple project. I want to build it into an executable file. I have followed this video with building an electron project. The build goes as it should.
loaded configuration file=package.json ("build" field)
description is missed in the package.json appPackageFile=C:\Users\evalo\Desktop\Desktop\electron\02-nekton\package.json
writing effective config file=dist\builder-effective-config.yaml
packaging platform=win32 arch=x64 electron=16.0.5 appOutDir=dist\win-unpacked
building target=nsis file=dist\nekton Setup 1.0.1.exe archs=x64 oneClick=false perMachine=false
building block map blockMapFile=dist\nekton Setup 1.0.1.exe.blockmap
After that, I ran the installer and installed the app without any problem and launched the shortcut, which had been generated on the desktop. The main window didn't show up but in Task Manager I could see that the application is running (3 times actually after one launch, don't know why)
Content of my package.json file, if it helps:
{
"name": "nekton",
"produktName": "nekton",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron .",
"build": "electron-builder"
},
"build": {
"asar": true,
"appId": "nekton",
"win": {
"target": [
"nsis"
],
"icon": "nekton.ico"
},
"nsis": {
"oneClick": false,
"installerIcon": "nekton.ico",
"uninstallerIcon": "nekton.ico",
"uninstallDisplayName": "Nekton-uninstaller",
"license": "license.md",
"allowToChangeInstallationDirectory": true
}
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-store": "^8.0.1",
"wallpaper": "^6.0.0"
},
"devDependencies": {
"electron": "^16.0.5",
"electron-builder": "^22.14.5"
}
}
One thing, which might affect this behaviour is that I hadn't saved electron as dev dependency before I started working on the app. I just installed it: npm i electron. When I tried to build it gave my error with a hint to move electron into dev dependencies. So I ran:
npm uninstall electron
npm i --save-dev electron
Tried to launch the app with: npm start and all worked flawlessly. So I assumed that this didn't affect the project.
**Edit:**
-----------------
I made and build an app to show static HTML files in the main window with the same build configuration. All worked flawlessly. The app launched and behaved as expected. So I have manually created a new project and copied the content of each file to the project which has been built before without error. I have encountered the same problem. The app works fine with npm start, builds, installs. After installation is complete the app 'runs' but without a window. I think there might be a run error, which would be logged into the terminal in vscode at the start and the application is halted. Is there a way I can see the terminal for my app after it has been installed?
Related
When I try to build one of the NextJS apps in my monorepo, I get the error:
$ rm -r packages/library/node_modules/; rm -r packages/daily/node_modules/; rm -r node_modules/; rm -r packages/shared/node_modules; rm package-lock.json; sudo rm -r packages/daily/.next/; npm i; npm --prefix packages/daily/ run build
> next build
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Creating an optimized production build
Failed to compile.
HookWebpackError: processor is not a function
> Build error occurred
Error: > Build failed because of webpack errors
at /home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/build/index.js:397:19
at async Span.traceAsyncFn (/home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/build/index.js:77:25)
The strange thing is that the node/npm version and code are exactly the same as a few days ago when I last ran this command successfully. I have never had this error before. I even tried cloning to a brand new Linux EC2 instance to see if there was some cached file screwing it up but I got exact same error. I am still able to re-deploy the latest commit on Heroku from a few days ago.
The next dev command works fine still.
The issue started happening when I tried to create a new website under packages/ . But the error is persisting even after I reverted to a commit before I made that code.
The monorepo contains two websites that share a package of shared code inside the repo called shared. Here is the webpack next.config.js file for the package/daily app. Again, no code has changed since the error started.
const withFonts = require('next-fonts');
const withTM = require('next-transpile-modules')(['#my-repo-name/shared']);
require('dotenv').config({ path: '../../.env' });
module.exports = withTM(withFonts({
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
webpack(config, options) {
return config;
},
}));
node version: v16.10.0
npm version: 7.24.0
(I also tried building using 16.14 and 8.3, and had the same error)
Also the root level package.json (with personal details redacted):
{
"name": "my-repo-name",
"version": "1.0.0",
"workspaces": {
"packages": [
"packages/*"
]
},
"keywords": [],
"author": "redacted-for-stack-overflow#stackoverflow.org",
"license": "UNLICENSED",
"description": "REDACTED FOR STACK OVERFLOW",
"engines": {
"node": "16.10.0"
},
"cacheDirectories": [
"node_modules",
"packages/library/.next/cache"
],
"scripts": {
"lint": "eslint . --ext js,jsx",
"build": "npm run build --prefix packages/$APP_NAME"
},
"dependencies": {},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-next": "^11.1.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0"
}
}
There was an incident yesterday which was causing the issue at Vercel. It should be fixed now.
Adding resolutions keys in package.json solved this for me. Hope this should be a temporary issue with vercel.
"resolutions": {
"cssnano-preset-simple": "3.0.0"
}
Using: Windows 10, NMP 6.4.1, Node v10.13.0, GIT 2.8.4
A simple app to show IMDB records:
https://ide.c9.io/learnwithcolt/webdevbootcamp folder APIS / movie_search_app
Dowloaded to run locally on Windows. It runs ok.
When I run:
electron-forge init my-new-app
√ Checking your system
It looks like you are missing some dependencies you need to get Electron running.
Make sure you have git installed and Node.js version 6.0.0+
package.json:
{
"name": "imdb",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^2.6.1",
"express": "^4.16.4",
"request": "^2.88.0"
},
"devDependencies": {
"electron": "^3.0.8"
}
}
The same happens with other proyects. CMD is running as Administrator.
The same happens with other proyects
Just with electron-forge or other CLI tools too? My guess is this is a path issue- electron forge can't find your Node/Git installations.
You can try npx electron-forge init my-new-app but that's a long shot.
Also, make sure you're using the correct version of Electron forge. There's a new one that's kinda broken right now.
The master branch is a rewrite of Electron Forge that will eventually be the 6.x series. If you are looking for the 5.x series (the version currently published to NPM), please view the 5.x branch.
https://github.com/electron-userland/electron-forge
I have my NodeJS app wrote using TypeScript and based on the Express framework. I want to host it in GCP cloud with gcloud app deploy command.
So, first of all, I build my TS sources to JavaScript -is that the correct way of doing it?.
Then from the build (with JS source code) folder I'm trying to run npm start command and it works successfully and I'm also able to check it with Preview:
.
It works well. So far, so good.
Then I run gcloud app deploy from the build folder (with built to JS sources) and I didn't see any errors during deploy.
But afterward, I receive a 500 error on each request whenever I'm trying to reach the deployed app. I've taken a look into a log and I see next error:
Error: Cannot find module 'express'
What seems to be the problem?
I tried the next commands in the build folder:
npm install
npm install express --save
npm install -g express
sudo apt-get install node-express
Nothing works for me.
Here is my package.json file:
{
"name": "full-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc",
"dev": "node -r ts-node/register ./src/server.ts",
"debug": "ts-node --inspect ./src/server.ts",
"start": "node build/server.js",
"prod": "npm run build && npm run start"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"ts-node": "^7.0.1",
"typescript": "^3.0.1"
},
"dependencies": {
"#types/lodash": "^4.14.116",
"body-parser": "^1.18.3",
"connect": "^3.6.6",
"cors": "^2.8.4",
"crypto": "^1.0.1",
"express": "^4.16.3",
"firebase-admin": "^6.0.0",
"lodash": "^4.17.10"
}
}
Any idea what I'm missed? Is this the correct way to deploy an app wrote with TypeScript to GCP cloud?
app.yaml:
# [START app_yaml]
runtime: nodejs8
# [END app_yaml]
since you are running gcloud app deploy from within the build folder,probably the package.json is not deployed as npm install is run first by app engine there is no way express could be missing.you can go to gcp console and under app engine view the version and then under diagnose you can view the source(the files that were actually deployed to app engine).keep in mind that this is only possible for the standard version and not the flex.I can see from your app.yaml you are using the standard.If some files are missing then go to your app root directory and in your .gcloudignore file you can ignore the files/folders you do not want to deploy.then run gcloud app deploy from within the root directory of your project
The problem was pretty simple. Seems like gcloud app deploy use npm run build & npm run start commands to start application somewhere inside. To host Node.Js wrote on TS first we need to build it to simple JS using tsc command. Then in the build folder rewrite package.json file to use correct commands. Look at my start command: "start": "node build/server.js". I was using it inside build folder as well so that's mean gcloud command was searching in /build/build/ folder. I've changed start command to "start": "node server.js" and then all works well.
I have just started with nodejs and app engine. I am following the tutorial
https://cloud.google.com/nodejs/tutorials
1) I have created a project then cloned the nodejs-mvms-quickstart repository.
2) Opened Development/source code and opened the nodejs-mvms-quickstart/1-hello-world
3) and started the node server
npm start
This is working fine. Now I want to deploy my nodejs application from my local server without copying to github and cloning on the server.
For this I am using following command
gcloud app deploy
but this is showing following errors:
If this is your first deployment, this may take a while...done.
Beginning deployment of service [default]...
Building and pushing image for service [default]
WARNING: No node version specified. Please add your node version, see https://docs.npmjs.com/files/package.json#engines
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[C:\Users\Sunil Garg\AppData\Roaming\gcloud\logs\2017.05.07\20.38.59.221000.log]
.
Started cloud build [1cd2979e-527b-4d68-b430-31471534246e].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/1c
d2979e-527b-4d68-b430-31471534246e?project=help-coin
ERROR: gcloud crashed (error): [Errno 10054] An existing connection was forcibly
closed by the remote host
If you would like to report this issue,please run the following command:
gcloud feedback
To check gcloud for common problems,please run the following command:
gcloud info --run-diagnostics
Here is my package.json
{
"name": "myapp",
"version": "1.0.0",
"description": "myapp",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"body-parser": "^1.15.0",
"connect-timeout": "^1.8.0",
"express": "^4.13.4",
"generic-pool": "^2.4.2",
"multer": "^1.2.0",
"mysql": "^2.10.2",
"requestify": "^0.1.17"
}
}
What is the issue? Am I missing something?
Try adding the following 2 parameters to the package.json
Add the version of node your application is compatible with.
"engines": {
"node": "4.6.0"
}
since you're using npm start you might need this in the script parameter as well since npm start is calling command stated in start in script param, change app.js according your application, like node quickstart.js. Always make sure to specify the path if your package.json is in the root directory and the .js is in a sub directory as well.
"scripts": {
"start": "node app.js"
}
I am migrating an ES2015 node.js application from Heroku to Azure.
The current start-up command running on Heroku is
"start": "./node_modules/babel-cli/bin/babel-node.js index.js"
However, on Azure I am getting
Invalid start-up command "./node_modules/babel-cli/bin/babel-node.js index.js" in package.json. Please use the format "node <script relative path>".
Which indicates that Azure only supports vanilla node for npm start.
I'm aware that running babel-node on production isn't ideal, but I was hoping for a straightforward migration.
Three options that would require a bit of re-architecting are:
Using a gulp workflow to precompile ES2015: https://github.com/christopheranderson/azure-node-es2015-example
Using a bash workflow to precompile ES2015: http://www.wintellect.com/devcenter/dbaskin/deploying-an-es6-jspm-nodejs-application-to-azure
Using babel-register ala [link in comments].
I suspect option 3 will be easiest but checking if anyone has come across a similar issue and managed to run babel-node directly in npm start on Azure.
According your issue, please modify your start npm script to node ./node_modules/babel-cli/bin/babel-node.js index.js on Azure Web Apps.
Here is the content in test package.json:
{
"name": "website",
"description": "A basic website",
"version": "1.0.0",
"engines": {
"node": "5.9.1",
"npm": "3.7.3"
},
"scripts": {
"start": "node ./node_modules/babel-cli/bin/babel-node.js index.js"
},
"dependencies": {
"babel-preset-es2015": "^6.6.0",
"babel-cli": "^6.0.0"
}
}
Meanwhile if you need a higher Node.js version, you can specify in package.json, refer to https://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/ for more.
Just as what Gary said, you need to update your package.json using the command below.
"scripts": {
"start": "node ./node_modules/babel-cli/bin/babel-node.js index.js"
}