Why doesn't npm start run electron app?

試著忘記壹切 提交于 2019-12-22 09:58:12

问题


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?


回答1:


Delete the node_modules folder and then run npm install.



来源:https://stackoverflow.com/questions/44370512/why-doesnt-npm-start-run-electron-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!