Why doesn't npm start run electron app? - node.js

I have the following in package.json for several electron apps:
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
When I'd do npm start in the app folder, the corresponding app use to run. I just started getting the following output for all of my electron apps when using npm start:
electron .
module.js:471
throw err;
^
Error: Cannot find module './'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25).
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/me/electron/my-app/node_modules/.bin/electron:3:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! m1#1.0.0 start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the m1#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
However, I can do either of the following successfully on the command line:
electron main.js
electron .
Anyone know what might have broken the package.json script? Or some other suggestions?

Delete the node_modules folder and then run npm install.

Related

Keep getting missing module error when trying to do npm start

I keep getting the following error:
> kb-ui#0.0.1 start C:\Users\Tayeb\Desktop\F2f\bloomkonnect-fe
> webpack-dev-server --open --config webpack.dev.js --progress --watch
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'json-parse-better-errors'
Require stack:
- C:\Users\Tayeb\AppData\Roaming\npm\node_modules\webpack\lib\Compiler.js
- C:\Users\Tayeb\AppData\Roaming\npm\node_modules\webpack\lib\webpack.js
- C:\Users\Tayeb\AppData\Roaming\npm\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Users\Tayeb\AppData\Roaming\npm\node_modules\webpack\lib\Compiler.js:7:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Tayeb\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js',
'C:\\Users\\Tayeb\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\webpack.js',
'C:\\Users\\Tayeb\\AppData\\Roaming\\npm\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kb-ui#0.0.1 start: `webpack-dev-server --open --config webpack.dev.js --progress --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kb-ui#0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Tayeb\AppData\Roaming\npm-cache\_logs\2021-06-23T17_23_33_473Z-debug.log
I have tried doing the following:
remove the node modules folder and run npm install
remove the node modules and package lock json and do npm install
re install node.js
delete the clone the repository again
I dont get what is wrong. When I look inside the node modules folder the module it is saying is missing is there. This is driving me nuts.

Having Problems with Node JS and AWS Elastic Beanstalk

I am getting the flowing errors when I try to build out my app in elasitcbeanstalk
var/log/nodejs/nodejs.log
Error: Cannot find module 'express'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/app/current/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#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?
> app#1.0.0 start /var/app/current
> node index.js
internal/modules/cjs/loader.js:638
throw err;
Image of Elasticbeanstak Config Files
My workspace
Try in NodeCommand with : "npm install && npm run start"

Installing electron on windows?

I tried to install electron js in windows 7 32 bits with node.js v=12.13.10
and npm v=6.11.2
I tried to install normal but when it start it gives me:
openssl config failed: error:02001003:system library:fopen:No such process
I tried like in electron documentation
(just copie past) .When I run
npm start
It give me te following error
openssl config failed: error:02001003:system library:fopen:No such process
openssl config failed: error:02001003:system library:fopen:No such process
> first-app#0.1.0 start C:\Users\Acer\Desktop\app
> electron
C:\Users\Acer\Desktop\app\node_modules\electron\index.js:14
throw new Error('Electron failed to install correctly, please delete
node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete
node_modules/electron and try installing again
at getElectronPath
(C:\Users\Acer\Desktop\app\node_modules\←[4melectron←[24m\index.js:14:11)
at Object.<anonymous>
(C:\Users\Acer\Desktop\app\node_modules\←[4melectron←[24m\index.js:18:18)
←[90m at Module._compile (internal/modules/cjs/loader.js:956:30)←[39m
←[90m at Object.Module._extensions..js
(internal/modules/cjs/loader.js:973:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:812:32)←[39m
←[90m at Function.Module._load
(internal/modules/cjs/loader.js:724:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:849:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
at Object.<anonymous>
(C:\Users\Acer\Desktop\app\node_modules\←[4melectron←[24m\cli.js:3:16)
←[90m at Module._compile (internal/modules/cjs/loader.js:956:30)←[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! first-app#0.1.0 start: `electron`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the first-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
this is my package.json file
{
"name": "app",
"version": "1.0.0",
"main": "main.js",
"description": "my first app",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^7.0.1"
}
}

Node.js / npm: Can't find module when running in dev mode

When running npm run dev, I got the following error message:
Error: Cannot find module 'webpack/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
at Function.Module._load (internal/modules/cjs/loader.js:497:25)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Isabelle\coursetro-eth\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! coursetro-eth#1.0.0 dev: `webpack-dev-server --config build/webpack.dev.conf.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the coursetro-eth#1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
My enviroment is the following:
OS: Windows 10
NPM: Version 5.6.0
WebPack: Version 4.6
My package.json file:
{
"name":"coursetro-eth",
"version":"1.0.0",
"main":"index.js",
"scripts":{
"dev":"webpack-dev-server --config build/webpack.dev.conf.js",
"publish":"ngc -p tsconfig-aot.json",
"test":"echo \"Error: no test specified\" && exit 1"
},
"author":"",
"license":"ISC",
"description":"",
"dependencies":{
"web3":"github:ethereum/web3.js"
},
"devDependencies":{
"lite-server":"^2.3.0",
"webpack":"^4.6.0",
"webpack-cli":"^2.0.15",
"webpack-dev-server":"^2.11.2",
"webpack-validator":"^2.3.0"
}
}
What is this error about?

Cannot find module 'has-flag'

Getting below error while "npm run build" on server.On local machine working fine. Getting 500 response on server
node version:8.0
npm version: 5.0.3
Error: Cannot find module 'has-flag'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
(/usr/share/../../../node_modules/postcss/node_modules/supports-color/index.js:2:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ***#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ***#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Try npm install --save has-flag. It looks like supports-color is requiring has-flag to be installed but it isn't. If you need to install any other packages you can just type npm install.
The above didn't work for me, but deleting my node_modules and dist folders and rerunning npm install did.

Resources