Electron app won't run. cant figure out why - npm

when typing npm start it gives me this error:
npm ERR! errno 1
npm ERR! helloworld#1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the helloworld#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
here is the package.json
{
"name": "helloworld",
"version": "1.0.0",
"description": "my app",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "kamalyaka",
"license": "MIT"
}
Please help.

You need to first install all the dependencies.
Try executing
npm install
first in your project directory.
After the dependencies are installed then you can execute
npm start
which will start your electron app.

Related

Build Failed Command "npm install" exited with 1 [duplicate]

This question already has answers here:
Fix the upstream dependency conflict installing NPM packages
(15 answers)
Closed 5 months ago.
so since the project started the deploy never had a problem, and out of nowhere today this message started to appear on vercel...
the application was coded using next js
I searched and searched and couldn't find a solution that worked for me...
Cloning github.com/ThiagoC0STA/kfk (Branch: main, Commit: f69b855)
Cloning completed: 1.077s
Looking up build cache...
Build Cache not found
Running "vercel build"
Vercel CLI 28.2.2
Installing dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-elastic-carousel#0.11.5
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"18.2.0" from the root project
npm ERR! peer react#"^17.0.2 || ^18.0.0-0" from next#12.2.5
npm ERR! node_modules/next
npm ERR! next#"12.2.5" from the root project
npm ERR! 5 more (react-dom, react-slick, styled-components, styled-jsx, use-sync-external-store)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"15 - 17" from react-elastic-carousel#0.11.5
npm ERR! node_modules/react-elastic-carousel
npm ERR! react-elastic-carousel#"^0.11.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"15 - 17" from react-elastic-carousel#0.11.5
npm ERR! node_modules/react-elastic-carousel
npm ERR! react-elastic-carousel#"^0.11.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /vercel/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-09-12T18_11_25_601Z-debug-0.log
Error: Command "npm install" exited with 1
package.json
{
"name": "kfk",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.2.5",
"next-images": "^1.8.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-elastic-carousel": "^0.11.5",
"react-slick": "^0.29.0",
"slick-carousel": "^1.8.1",
"styled-components": "^5.3.5"
},
"devDependencies": {
"babel-plugin-styled-components": "^2.0.7",
"eslint": "8.22.0",
"eslint-config-next": "12.2.5"
}
}
I don't understand why I have this error out of the blue, since I've been deploying for weeks and this started out of nowhere.
Try running
npm install --legacy-peer-deps
If it's necessary, you can try to use --force
npm install --force
Here was the docs
Npm install --force

create-react-app dependency version issues with React 18

npx create-react-app my-project results in the following dependency errors:
npx version: 8.5.0
Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: react-18#0.1.0
npm ERR! Found: react#18.0.0
npm ERR! node_modules/react
npm ERR! react#"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"<18.0.0" from #testing-library/react#12.1.5
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^12.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
The command still produces a project directory, but running npm start in the created directory errors with web-vitals missing from node-modules.
Solutions tried
Running the same command with --force or --legacy-peer-deps as suggested by the above error message doesn't solve the problem.
Deleting node_modules and package-lock.json and running npm i also doesn't solve the problem.
Update
The problem has been fixed with the latest update of create-react-app. Now it creates a project without any problem.
Until this is fixed for now you can delete the node_modules folder and package-lock.json. Next, open package.json and change
"react": "^18.0.0" & "react-dom": "^18.0.0" to an earlier version e.g:
"react": "^17.0.2" & "react-dom": "^17.0.2".
Finally, you can run npm install.
Alternative Solution (Try this first!):
solution suggested by joooni1998):
delete both node_modules and package-lock.json
run npm i web-vitals --save-dev
run npm install
and then you can use npm run build and npm start again
Check here for the Github issue.
Here is a temporary workaround:
Install cra-template to a separate folder (other than your new
project app's folder) using "npm install cra-template"
Go to the installed cra-template package folder and in file "template.json" change the line '"#testing-library/react": "^12.0.0"' to '"#testing-library/react": "^13.0.0"'
Go back to your root folder and run npx create-react-app my-app (your app name) --template file:PATH_TO_YOUR_CUSTOM_TEMPLATE
Additionally, you can let the build fail, remove the node_modules folder as well as the package-json.lock file. Open the package.json file and change the react and react-dom to an earlier version.
For example:
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"cra-template": "1.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"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"
]
}
}
Delete reportWebVitals.js
Remove import reportWebVitals from './reportWebVitals'; from index.js
Remove reportWebVitals(); from the bottom of index.js
Finally run npm install
It worked for me by deleting both 'node_modules' folder and 'package-lock.json' file. Then, I changed both react and react-dom version to 17.0.2 instead of 18.0.0 inside the package.json file as suggested by Gavriel's answer https://stackoverflow.com/a/71836018/12490294. Then, inside the app folder, I ran
npm i web-vitals --save-dev
Then
npm start
The app started successfully
Or you can try this npx --legacy-peer-deps create-react-app my-appname or goto index.js and remove the usage of web vitals
or downgrade npm with npm install -g npm#8.3.0 and create react app.
You could use yarn add create-react-app your-app instead
Try running either with --force or with --legacy-peer-deps, both will install dependencies without problems.
If that doesn't work, then delete the node modules folder and start installing from scratch

How to get npm to install a single package?

I have downloaded an npm project, and npm install fails with a bunch of dependency errors. In an attempt to find the problem, I've tried installing each dependency individually with, e.g., npm install react, but the command ignores the single argument and instead gives the same errors as trying to install the entire project. In desperation I tried the example from https://docs.npmjs.com/cli/v8/commands/npm-install: 'npm install sax`, where sax has nothing to do with the project, and it still fails.
package.json is:
{
"name": "graphiql-explorer-example",
"homepage": "https://onegraph.github.io/graphiql-explorer-example",
"version": "0.1.0",
"private": true,
"dependencies": {
"graphiql": "^0.12.0",
"graphql": "^14.1.1",
"graphiql-explorer": "^0.6.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"flow": "flow",
"deploy": "gh-pages -d build",
"predeploy": "yarn build",
"prettier": "prettier --write \"src/**/*.js\" \"docs/**/*.md\" README.md"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"flow-bin": "^0.91.0",
"gh-pages": "^2.0.1"
},
"description": "Example usage of [OneGraph](https://www.onegraph.com)'s open source [GraphiQL explorer](https://github.com/OneGraph/graphiql-explorer).",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/OneGraph/graphiql-explorer-example.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/OneGraph/graphiql-explorer-example/issues"
}
}
The error messages are:
> npm install react
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: graphiql-explorer-example#0.1.0
npm ERR! Found: graphql#14.1.1
npm ERR! node_modules/graphql
npm ERR! graphql#"^14.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql#"^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0" from graphiql#0.12.0
npm ERR! node_modules/graphiql
npm ERR! graphiql#"^0.12.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
The log file (excluding a pile of "timing" and "silly" messages) is:
1 info using npm#8.8.0
2 info using node#v16.14.2
22 verbose title npm install sax
23 verbose argv "install" "sax"
41 http fetch GET 200 https://registry.npmjs.org/graphiql 144ms (cache revalidated)
43 http fetch GET 200 https://registry.npmjs.org/graphql 47ms (cache revalidated)
47 verbose stack Error: unable to resolve dependency tree
As you can see, npm parses the "sax" argument correctly on line 23, but then ignores it and tries to install graphiql instead.
How can I get npm to install a single package, such as the latest version of react, instead of trying to install all of the dependencies for graphiql-explorer?
the problem here is the peer dependencies of "sax"
there are some ways to avoid checking peer dependency.
Method 1
npm install <package name> --force
or
npm install <package name> --legacy-peer-deps
but it is not recommended,
Adding --legacy-peer-deps to your npm installation will bypass peerDependency auto-installation, but this may result in conflicts due to potentially breaking changes
try to resove conflicts manually, by getting the peer dependency details using
npm info name-of-module peerDependencies
for more information refer: What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?
There is a fix for running the npm install command.
$ npm install
According to your error message when running the installation command:
npm ERR! ERESOLVE unable to resolve dependency tree
It states that some dependencies are incompatible with others. To fix this, you need to run the installation command with the following flag.
$ npm install --legacy-peer-deps
This should resolve the issue of the dependencies being incompatible with each other.
In conclusion, the issue was that the dependencies were incompatible with each other. However, there is a fix!
$ npm install --legacy-peer-deps

How to tell npm to install from local not git

I have a server without internet access but a local npm. I'm trying to install a Node.js application, and one of the modules points to github. The package is part of one of the dependencies packages.
{
"name": "doccano",
"version": "1.0.0",
"description": "doccano is an open source annotation tools for machine learning practitioner.",
"author": "Hironsan",
"private": true,
"scripts": {
...
"dependencies": {
...
"#toast-ui/vue-editor": "^1.1.1",
...
}
}
Most packages are downloaded from local npm, but some point to github, and then I get the error:
npm install
...
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/seonim-ryu/Squire.git
npm ERR!
npm ERR! ssh: Could not resolve hostname github.com: Name or service not known
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
I can download the repository and upload it to the server, but how can I install the github packages?

I keep getting `errno 4058` from npm

I used npm in the last weeks without any problems, but all of the sudden i keep getting this error:
npm ERR! path J:\Work\Web_server\create_file\node_modules\depd
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'J:\Work\Web_server\create_file\node_modules\depd' -> 'J:\Work\Web_server\create_file\node_modules\.depd.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\crist\AppData\Roaming\npm-cache\_logs\2018-08-13T09_21_56_509Z-debug.log
This is the package.json:
{
"name": "create_file",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies":{
},
"devDependencies":{
"express": "4.16.3"
}
}
The thing is, it also happens when I manually install a package. What am I doing wrong? Thanks
Edit: And when I tried it on a different directory the manual installation worked. I have no idea why.
I faced the same error on macOS 10.12.6, Node 8.3.0, NPM 5.3.0. It often, but not always is referring to .DELETE. It does always report ENOENT: no such file or directory
There are no other Node processes running. I closed Visual Studio Code, still seeing ENOENT.
QuickFix:
Delete package-lock.json and run NPM again
try this to solve your error
1st check your port is running or not through this command
lsof -i :8080 // <- this is your port whatever you used
the port is cotinuesly run or not if it run then use the below command
kill -9 14528 //your procee Id
then once try to run
node index.js