Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't npm start run electron app?

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! [email protected] start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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?

like image 733
4thSpace Avatar asked Jun 05 '17 13:06

4thSpace


1 Answers

Delete the node_modules folder and then run npm install.

like image 90
Ian Wise Avatar answered Oct 19 '22 14:10

Ian Wise