无法启动Electron应用程序-缺少package.json [英] Cannot start Electron application - missing package.json

查看:893
本文介绍了无法启动Electron应用程序-缺少package.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做一个Python项目,我想在Electron应用程序中显示结果.我在YouTube上观看了有关如何在Mac上设置Electron的演示视频.视频显示了要在终端中执行的3个简单步骤:

git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm start

当我第一次运行以上命令时,它对我来说很好用.我能够启动Electron应用程序.

但是当我尝试进入electron-quick-start目录后使用命令npm start重新启动应用程序时,无法打开该应用程序.

我不断收到如下错误消息:

(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$ npm start
npm ERR! path /Users/vivekchowdary/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/vivekchowdary/package.json'
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!     /Users/vivekchowdary/.npm/_logs/2019-04-19T12_55_01_157Z-debug.log
(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$ 

我不知道这意味着什么吗?但是我只想打开Electron应用程序.

解决方案

错误消息指出,找不到文件package.json.

一个可能的原因是终端不在正确的项目文件夹中,并且您需要在运行npm start之前将cd放入文件夹中.

如果cd转到没有package.json的任何文件夹(并且其父文件夹没有package.json)并运行npm start,则会显示此错误消息.

您的特定文件路径似乎表明您是从主文件夹(而不是包含package.json的项目文件夹)运行的.

I'm currently doing a Python project where I want to display my results in an Electron application. I have seen a demo video on YouTube on how to set up Electron on a Mac. The video showed 3 simple steps to be executed in the terminal:

git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm start

When I first ran the above commands it worked fine for me. I was able to start the Electron application.

But when I tried to re-start the application using the command npm start after going into the electron-quick-start directory, I am not able to open the application.

I am continuously getting an error message as follows:

(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$ npm start
npm ERR! path /Users/vivekchowdary/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/vivekchowdary/package.json'
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!     /Users/vivekchowdary/.npm/_logs/2019-04-19T12_55_01_157Z-debug.log
(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$ 

I don't know what it means? But I just want to open the Electron application.

解决方案

As the error message states, the file package.json cannot be found.

One possible reason is that the terminal is not in the correct project folder and that you need to cd into the folder before running npm start.

If you cd to any folder that has no package.json (and whose parent folders don't have a package.json) and run npm start, you'll be presented with this error message.

Your specific file path seems to indicate that you ran npm start from your home folder, not the project folder that contains package.json.

这篇关于无法启动Electron应用程序-缺少package.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆