NPM为什么不开始运行电子应用程序? [英] Why doesn't npm start run electron app?
问题描述
在package.json中,我有几个电子应用程序:
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 ."
},
当我愿意 npm start
在app文件夹中,用于运行相应的应用程序。当使用 npm start
时,我才开始为我的所有电子应用程序获取以下输出:
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
抛出错误;
^
module.js:471
throw err;
^
错误:在Function.Module._resolveFilename(module.js:469:15上找不到模块'./'
)
Function.Module._load(module.js:417:25)的
。
Module.require(module.js:497:17)的
在require(internal / module.js:20:19)
在Object处。 (/Users/me/electron/my-app/node_modules/.bin/electron:3:16)
在Module._compile(module.js:570:32)
在Object.Module._extensions..js(module.js:579:10)处
在Module.load(module.js:487:32)
在tryModuleLoad(模块。 js:446:12)
在Function.Module._load(module.js:438:3)
npm错误!代码ELIFECYCLE
npm错误! errno 1
npm错误! m1@1.0.0开始: electron。
npm错误!退出状态1
npm ERR!
npm ERR!在m1@1.0.0启动脚本处失败。
npm ERR! npm可能不是问题。上面有
可能会有更多日志记录输出。
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 .
任何人都知道怎么可能破坏了package.json脚本?还是其他建议?
Anyone know what might have broken the package.json script? Or some other suggestions?
推荐答案
删除 node_modules
文件夹,然后运行 npm install
。
Delete the node_modules
folder and then run npm install
.
这篇关于NPM为什么不开始运行电子应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!