Electron实现前后端同时启动-比较傻

福尔摩斯对我笑 2019-02-20 7315 次 3112条

前言

  • 手头有个electron项目,其实就是将网页打包在了electron里面,直接加载的url,主要的程序其实在云端的服务器进行存储。
  • 今天我想了想,觉得太浪费钱了,为何不将程序一块打包,这样electron启动的同时也启动node项目,不就节省了服务器钱了嘛,当然,这会增加文件的大小。不过,还是试试吧。
利用cmd打开node服务
  • 谷歌了下,没找到任何相关资料,一筹莫展,去了个洗手间,想到了我的另外一篇文章 node使用cmd命令
    于是,我想了想,假设我在electron启动后,再通过cmd命令启动我的node项目,不就成了。

**** 对,我想electron启动后,直接用下面的代码,去启动了node项目,貌似解决了这个问题。

var exec = require('child_process').exec;
function execute(){
exec('npm run production', {cwd: process.cwd()+'\\server'},function(error, stdout, stderr) {
        if(error){
            console.log(error);
        }
        else{
            console.log("成功");
        }
    });

不过,这样好像比较傻,电脑上必须安装node环境才能正常运行。

标签:

非特殊说明,本博所有文章均为博主原创。

头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 3112 条评论 1


  1. hore

    Can I simply say what a comfort to find someone that actually understands what they are talking about over the internet. You definitely realize how to bring a problem to light and make it important. A lot more people ought to read this and understand this side of the story. I was surprised you’re not more popular given that you certainly have the gift.

    回复 2020年2月26日
  2. via cream

    wonderful put up, very informative. I’m wondering why the other specialists of this sector don’t realize this. You should continue your writing. I’m sure, you’ve a huge readers’ base already!

    回复 2020年2月26日
  3. Folding Mountain Bikes

    I don’t even know the way I stopped up right here, however I thought this publish was once good. I don’t recognise who you might be but definitely you are going to a famous blogger for those who aren’t already 😉 Cheers!

    回复 2020年2月26日
  4. reddit nba streams

    Great write-up, I am regular visitor of one’s blog, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.

    回复 2020年2月26日
  5. anus

    I was excited to uncover this web site. I need to to thank you for ones time just for this wonderful read!! I definitely enjoyed every little bit of it and i also have you saved as a favorite to check out new information on your site.

    回复 2020年2月26日
  6. pussy

    Aw, this was a really nice post. Finding the time and actual effort to make a superb article… but what can I say… I procrastinate a lot and don’t manage to get anything done.

    回复 2020年2月26日
  7. negro

    After I initially left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and now each time a comment is added I receive four emails with the same comment. Perhaps there is an easy method you are able to remove me from that service? Appreciate it!

    回复 2020年2月26日
  8. viagra

    Your style is really unique in comparison to other folks I’ve read stuff from. Thank you for posting when you have the opportunity, Guess I will just book mark this web site.

    回复 2020年2月26日
  9. Lexus888 Net Sport

    I was able to find good advice from your blog articles.

    回复 2020年2月26日
  10. ass hole

    Oh my goodness! Awesome article dude! Thank you, However I am going through difficulties with your RSS. I don’t understand the reason why I can’t subscribe to it. Is there anybody else getting similar RSS problems? Anyone that knows the solution will you kindly respond? Thanks!!

    回复 2020年2月26日
  11. 우리 카지노

    I like what you guys tend to be up too. This kind of clever work and exposure!

    Keep up the superb works guys I’ve included you guys to my blogroll.

    回复 2020年2月26日
  12. SEO Baltimore

    bookmarked!!, I like your site!

    回复 2020年2月26日
  13. piss off

    I’m extremely pleased to uncover this page. I want to to thank you for ones time just for this wonderful read!! I definitely appreciated every little bit of it and I have you book-marked to see new stuff on your site.

    回复 2020年2月26日
  14. tuantender.id

    Hello, I believe your web site could be having browser compatibility problems. When I look at your web site in Safari, it looks fine but when opening in IE, it’s got some overlapping issues. I simply wanted to give you a quick heads up! Other than that, great site!

    回复 2020年2月26日
  15. Wholesale CBD Company

    Hi everyone at weilai.info! Stock Uⲣ On CBD is thе Planet’s
    very first wholesale CBD marketplace ԝhere youu can easily choose tօp-drawer CBD produhcts tһroughout multiple categories
    ѕuch as CBD Chocolate from the tоp Hemp annd CBD brand names.

    We are cսrrently wishing tօ addd a feѡ more CBD and Hemp stores.

    Ⅽould you aⅼlow me to know the naame of your local CBD аnd Hemp Shop?

    回复 2020年2月26日
  16. 우리카지노

    From WhatsApp:

    एक मतदाता EVM के सामने
    बड़ी देर तक बिना वोटिंग किये खड़ा
    था.

    पोलिंग ऑफ़िसर ने पूछा:
    “भाई साहब, क्या सोच रहे हो?”

    उसने कहा: “रात को
    किसने पिलायी, वो याद
    नहीं आ रहा”
    …. https://uricasino114.com

    回复 2020年2月26日
  17. 우리카지노

    From WhatsApp:

    एक मतदाता EVM के सामने
    बड़ी देर तक बिना वोटिंग किये खड़ा था.

    पोलिंग ऑफ़िसर ने पूछा:

    “भाई साहब, क्या सोच रहे हो?”

    उसने कहा: “रात को
    किसने पिलायी, वो याद नहीं आ रहा”
    …. https://uricasino114.com

    回复 2020年2月26日
  18. Abbruch Abbruch

    Aw, this was an extremely nice post. Taking a few minutes and actual effort to generate a top notch article… but what can I say… I hesitate a lot and never manage to get nearly anything done.

    回复 2020年2月26日
  19. pop up exhibits

    Its not my first time to go to see this site, i am browsing this web site dailly and get nice facts from here all
    the time.

    回复 2020年2月26日
  20. SM 카지노

    This design is spectacular! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my
    own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

    回复 2020年2月26日
  21. anus

    Pretty! This has been an extremely wonderful article. Thank you for providing this information.

    回复 2020年2月26日
  22. Lyjmoon.Com

    magnificent issues altogether, you just received a
    brand new reader. What could you suggest about your put up that you simply
    made a few days in the past? Any certain?

    回复 2020年2月26日
  23. gook

    When I initially left a comment I seem to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I recieve 4 emails with the exact same comment. There has to be a way you are able to remove me from that service? Thanks!

    回复 2020年2月26日
  24. filbert77.finance.blog

    Good web site you have got here.. It’s hard to find good
    quality writing like yours nowadays. I honestly appreciate people like you!
    Take care!!

    回复 2020年2月26日
  25. 충주릉콜걸샵〖카톡- Po 3 4〗〖Poo3 4.c0M〗외국인출장만남출장업계위Y⇗¤2019-04-03-18-57충주◙AIJ◇콜걸역출장안마출장연애인급☻출장소이스홍성➹콜걸만남★충주

    I needed to thank you for this excellent read!! I absolutely enjoyed every little bit of it. I’ve got you saved as a favorite to check out new things you post…

    回复 2020年2月26日
  26. Buy HCG

    Hi there very cool web site!! Man .. Beautiful ..
    Wonderful .. I’ll bookmark your site and take
    the feeds additionally? I am satisfied to seek out a lot of useful info here in the put up, we
    want develop more strategies on this regard, thanks for
    sharing. . . . . .

    回复 2020年2月26日
  27. fuckass

    Aw, this was a very good post. Taking a few minutes and actual effort to create a superb article… but what can I say… I hesitate a whole lot and never seem to get anything done.

    回复 2020年2月26日
  28. a325 tension control bolts

    Hey! I know this is somewhat off topic but I was wondering which blog platform are you using for this site? I’m getting sick and tired of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another platform. I would be fantastic if you could point me in the direction of a good platform.

    回复 2020年2月26日
  29. This site

    Your style is really unique in comparison to other people I have read stuff from. I appreciate you for posting when you have the opportunity, Guess I’ll just book mark this page.

    回复 2020年2月26日
  30. assfucker

    I love reading an article that can make people think. Also, many thanks for allowing me to comment!

    回复 2020年2月26日
  31. 모바일바카라

    Here is full thread of @kmalmarugan’s assessment of
    where Modi/Shah went wrong in TN….and why
    this could be one of the nails (if not the only nail) in the Sanghi … http://aiworkbench.info/__media__/js/netsoltrademark.php?d=uricasino369.com

    回复 2020年2月26日
  32. 모바일바카라

    Here is full thread of @kmalmarugan’s assessment of where Modi/Shah went wrong in TN….and
    why this could be one of the nails (if not the only nail) in the Sanghi … http://aiworkbench.info/__media__/js/netsoltrademark.php?d=uricasino369.com

    回复 2020年2月26日
  33. Burton

    Hello, just wanted to mention, I loved this article. It was funny.

    Keep on posting!

    回复 2020年2月26日
  34. f2280 tc bolts

    Hey would you mind stating which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique. P.S Apologies for getting off-topic but I had to ask!

    回复 2020年2月26日
  35. modern construction materials ppt

    Hello! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog and look forward to new updates.

    回复 2020年2月26日
  36. wikitopx

    I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.

    nonetheless, you command get got an shakiness over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly a
    lot often inside case you shield this hike.

    回复 2020年2月26日
  37. hardcore

    I really like it when folks get together and share opinions. Great website, keep it up!

    回复 2020年2月26日
  38. Lotto Jackpot

    Aw, this was a very nice post. Taking the time and actual effort to make a good article… but what can I say… I put things off a lot and never seem to get anything done.

    回复 2020年2月25日
  39. 바카라 사이트

    Why people still make use of to read news papers
    when in this technological world everything is available on web?

    回复 2020年2月25日
  40. website

    I am really impressed with your writing skills as well as with the layout on your
    blog. Is this a paid theme or did you modify it yourself?
    Either way keep up the excellent quality writing, it is rare to see a great blog like this one nowadays.

    回复 2020年2月25日
  41. shit

    I couldn’t refrain from commenting. Perfectly written!

    回复 2020年2月25日
  42. Home Inspection Fayetteville NC

    I would like to thank you for the efforts you’ve put in writing this blog. I really hope to check out the same high-grade content by you in the future as well. In fact, your creative writing abilities has inspired me to get my very own blog now 😉

    回复 2020年2月25日
  43. human hair wigs

    human hair wigs
    The denotation of “primitive” simply means “early” or “first of its kind,” but the connotation means
    crude, simple, backward, and stuck in an early stage of development.
    Use of so called Stone Age technology, absence of written histories, and the failure to build great cities are three criteria
    that have been used to label a culture as primitive. However, Africans
    have smelted and forged iron since 500 BCE, made ad used high
    quality steel for weapons and tools, recorded their
    histories in Arabic since 10th century CE, and built great cities like Benin and Luanda..

    lace front wigs And I know she knew exactly what she was doing.
    I am sure she was trying to make basic as terrible
    of an experience as possible so that he would wash out of
    the military on purpose. Joke on her, DH is really
    good friends with that drill sergeant, and they have hung out a couple of times
    since they both left the military.. lace front wigs

    tape in extensions In many countries, regulations require workers to wear protective clothing, such
    as safety helmets, shoes, vests etc., as appropriate.
    The obligation is generally on employers to ensure that their workers wear the appropriate protective clothing.

    Similarly, health regulations may require those who handle food
    to wear hair covering, gloves and other clothing..

    tape in extensions

    360 lace wigs Earwigs are largely nocturnal creatures that can easily be drawn in at night by any lights you
    have in or around your home. Avoid leaving on exterior lights whenever
    possible. Small solar lights, such as the ones used to illuminate
    walkways and flower gardens, are best kept somewhere away from the immediate area of your property.
    360 lace wigs

    cheap wigs human hair In 1995 Wiggs and Luscious Jackson (and original Beastie Boys) drummer
    Kate Schellenbach formed Ladies Who Lunch, releasing the 7 vinyl “Kims We Love” (an homage to Kim Deal and Sonic Youth’s
    Kim Gordon, played entirely on Casio keyboards) on the Beastie Boys’ label,
    Grand Royal. This was followed by the 7 vinyl cover of the Buzzcocks song Everybody’s Happy Nowadays.In 1995, Wiggs recorded
    and co produced the album Klassics with a K for the Kostars, Luscious Jackson’s Jill Cunniff and Vivian Trimble,
    and toured with them playing drums. In 1996 Wiggs
    collaborated again with Jon Mattock releasing the Bon Bon Lifestyle album
    on Grand Royal as The Josephine Wiggs Experience.

    cheap wigs human hair

    hair extensions A friend in New York had called to tell me
    about a memo floating around CBS News mandating
    that ‘the next reporter we hire will be a woman.'”[8] According to Stahl, Connie Chung and Bernard Shaw were “the
    two other ‘affirmative action babies’ in what became
    known as the Class of ’72.”[9] Stahl reflected in an interview on her early days at CBS how, on the night of the ’72 Nixon McGovern election returns, she found her on air studio chair marked with masking tape, not with her name as with her colleagues, but with “Female.” Stahl was the mentor of CBS news producer Susan Zirinsky.[10]Stahl’s prominence grew after she covered Watergate. “I found an apartment in the Watergate complex, moved all my stuff from Boston, and didn’t miss a day
    of work. June 1972. hair extensions

    tape in extensions The advent of the wig in Europe (primarily France and
    England) was a prophylactic one. The straight fact
    was that head lice were a genuine concern in the 17th century and a thickly woven mat atop one’s head worked wonders for keeping the lice out of a person’s scalp,
    and it was much preferred over the shaving of one’s head.
    For the most part, the early wigs were not a fashion statement at
    all, and they were worn for practicality. tape in extensions

    tape in extensions I am baffled by today. I assumed the memo would
    atleast contain SOME juice, but nothing. Nothing at all.

    Definitely have a sweet tooth with this pregnancy that I didn’t have
    with my son. With my son, I craved savory things. My doctor said to buy fruit at
    the farmer’s market. tape in extensions

    cheap wigs human hair I had genetic screenings,
    tons of pre natal and post natal visits, classes with lactation consultant nurses and a
    years maternity leave and it was paid for by my provincial healthcare here
    in Canada. My province paid me for having a child. The government pays
    a percentage of your prebirth salary to you, and the hope is your employer pays the other portion..
    cheap wigs human hair

    clip in extensions Put a darker shirt on over the suspenders
    so the suspenders wont show. Mine were dark suspenders so the showed under a white t shirt.
    With just the back part of the light on find the center
    of the bolt. It feels honestly like one of the old black
    and white space western serial TV shows, hero
    fantasy. If you like that sort of thing, that is good, but I enjoyed the Epics to
    be more fluid between books, each doesn necessarily need to be a complete conclusion. Feels Episodic in nature, a lot like the Laurel K Hamilton Anita Blake: Vampire Hunter
    series, which given is actually a romance novel series, has an amazing
    world of magic and magical creatures, very descriptive writing.

    clip in extensions

    wigs for women Endura Bond is safe for use on the skin. It does not contain formaldehyde,
    lead or mercury. Endura Bond has been specially formulated to keep
    “Crystallization” to a minimum. You’d wind up homeless.
    It’s a sad state of affairs I know, but it’s reality over here.
    It’s changing slowly, and I would love to be
    able to speed it up. wigs for women

    wigs for women And yes, the women wear head scarves, but
    most of them only do this because they have to. I’ve yet to
    see Persian women wearing them when travelling or living abroad.
    Additionally, all of the Persians I’ve known have looked totally Western in terms of dress.

    wigs for women

    clip in extensions Well, from what I gathered, criminology
    is the study of criminal behaviour, such as what may lead someone
    to commit a crime, what rehabilitation methods would be appropriate, and how to prevent future cases.
    I been interested in law since I was 11, and I began to realize that I strongly preferred criminal law to civil law.
    That, coupled with my interest in biology, eventually lead to an interest in looking over criminal cases
    a lot of them being murders, admittedly as well as reading up on crime
    scene details and transcripts. clip in extensions

    wigs online Let your personal walls come down and engage with your spark, your energy, your potential.
    It maddening, but that the duality of life: A delicate
    mix of being in control and out of control at times.
    Do the best you can, and even in uncertain times, rely
    on yourself and you can get through anything.
    wigs online

    human hair wigs That being said, all of them could fail that test and not be worth the
    side effects. Don feel like meds are your only recourse, there are other
    options that could be better for you. Honestly, if you scared of going back on a med,
    you probably shouldn go back on it. human hair wigs

    360 lace wigs Her appearance in the magazine opened the door for her to headline at and operate two different Playboy
    Jazz Clubs. Overseen by Hugh Hefner himself, the clubs were called
    “Lainie’s Lounge East” and “Lainie’s Lounge West”, each on opposite coasts, with one located in Manhattan and the other in Los
    Angeles. Her Playboy photographs inspired the look of Jack Kirby’s DC Comics superheroine,
    Big Barda.[8]Along with appearing in numerous
    supper clubs across the country, Kazan guest starred
    on Dean Martin’s variety series twenty six times 360 lace wigs.

    回复 2020年2月25日
  44. modern construction technology ppt

    Howdy just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.

    回复 2020年2月25日
  45. 파라오 카지노

    Your style is unique compared to other folks I
    have read stuff from. I appreciate you for
    posting when you have the opportunity, Guess I will just bookmark
    this page.

    回复 2020年2月25日
  46. adult

    I’d like to thank you for the efforts you’ve put in writing this blog. I’m hoping to check out the same high-grade blog posts from you later on as well. In truth, your creative writing abilities has motivated me to get my own, personal website now 😉

    回复 2020年2月25日
  47. 더나인카지노

    And i acquired the lens rank enhance. I think there must
    be a germ of fact in all cults for people to originally
    be drawn in. It’s just unhappy that it’s later perverted to develop into a vehicle for controlling lives and/or making
    a living. http://opac2.mdah.state.ms.us/stoneCollection.php?referer=http%3A%2F%2Fwww.yeta.vip%2Fspace.php%3Fuid%3D3193%26do%3Dblog%26id%3D81140

    回复 2020年2月25日
  48. 더나인카지노

    And i acquired the lens rank enhance. I think there
    must be a germ of fact in all cults for people to originally be drawn in. It’s just unhappy that it’s later perverted to develop
    into a vehicle for controlling lives and/or
    making a living. http://opac2.mdah.state.ms.us/stoneCollection.php?referer=http%3A%2F%2Fwww.yeta.vip%2Fspace.php%3Fuid%3D3193%26do%3Dblog%26id%3D81140

    回复 2020年2月25日
  49. anal

    You’re so awesome! I don’t suppose I’ve truly read anything like that before. So wonderful to find another person with a few original thoughts on this issue. Really.. thank you for starting this up. This web site is one thing that’s needed on the web, someone with a bit of originality!

    回复 2020年2月25日