zoukankan      html  css  js  c++  java
  • Electron中git, npm,webpack使用

    开始学习Electron的时候用到git, 记录学习一下, 学习地址是: https://zhuanlan.zhihu.com/p/20225295?columnSlug=FrontendMagazine

    1. 用git的时候进入一个目录是 cd D:test  可以进入d盘的文件路劲,跟git没关系

    2. 打开 Git bash here

    Jason Zeng@DESKTOP-ODB5KQB MINGW32 /e/Jason Zeng/Desktop/Electron
    $ git clone https://github.com/bojzi/sound-machine-electron-guide.git                       git克隆远程仓库
    Cloning into 'sound-machine-electron-guide'...
    remote: Counting objects: 107, done.
    remote: Total 107 (delta 0), reused 0 (delta 0), pack-reused 107
    Receiving objects: 100% (107/107), 3.37 MiB | 518.00 KiB/s, done.
    Resolving deltas: 100% (27/27), done.

    Jason Zeng@DESKTOP-ODB5KQB MINGW32 /e/Jason Zeng/Desktop/Electron
    $ cd sound-machine-electron-guide                          git 转入目录

    Jason Zeng@DESKTOP-ODB5KQB MINGW32 /e/Jason Zeng/Desktop/Electron/sound-machine-electron-guide (master)
    $ git tag                                         git 查看tag
    00-blank-repository
    01-start-project
    02-basic-sound-machine
    03-closable-sound-machine
    04-global-shortcuts-bound
    05-settings-window-working
    06-shortcuts-configurable
    07-ready-for-packaging

    Jason Zeng@DESKTOP-ODB5KQB MINGW32 /e/Jason Zeng/Desktop/Electron/sound-machine-electron-guide (master)

    $ git checkout 00-blank-repository

    Note: checking out '00-blank-repository'.

    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.

    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:

    git checkout -b <new-branch-name>

    HEAD is now at aac9eb8... blank repository

     3. 用node.js command prompt(把Node命令和npm命令都结合的环境)也很蛋疼,要切换一个目录,先要某个盘符下, 如E:后才能进入相应的文件夹, 用相对路劲的方式, 还默认进入了E盘下的第一个文件夹,服了!!!!!!

    C:WindowsSystem32>E:

    E:WorkSpace>    

    E:WorkSpace>cd ..SoftwareDistribution

    E:SoftwareDistribution>

    E:SoftwareDistribution>cd ..Jason ZengDesktopElectronsound-machine-electron-guide

    E:Jason ZengDesktopElectronsound-machine-electron-guide>

    4. 用node命令框时遇到抛出异常的时候用: ctrl+c 可以退出执行的环境

    5. npm start的时候遇到两个bug

      1. cannot find module 'app', 把下面的红字改成绿色的即可,错误原因:使用的Electron版本太新,这种API在 Electron v1.0.0 中被移除了。再出现 “Cannot find module ……” 的错误,基本上全是因为require直接引入模块了

        // var app = require('app');
        // var BrowserWindow = require('browser-window');

        const electron = require('electron');
        const app = electron.app;
        const BrowserWindow = electron.BrowserWindow;

        

          2.  loadUrl is not working in electron:   把 loadUrl改成loadURL就可以了

    界面如下:

     

    6. nom可以通过package.json来下载依赖模块

      1.package.json不存在时 
      命令:npm init可自动创建package.json文件

      2.package.json存在时 
      直接命令:npm install 或者 npm install –save-dev会自动将package.json中的模块安装到node-modules文件夹下

  • 相关阅读:
    如何在Root的手机上开启ViewServer,使得HierachyViewer能够连接
    java调用monkeyrunner(亲测绝对可行)
    如何在DOS窗口复制和粘贴命令
    查看当前APP打开的是哪个Activity
    MonkeyRunner之MonkeyRecorder录制回放脚本(亲测可正常运行)
    selenium python2.7安装配置
    常用adb操作命令详解
    Spring整合strus2简单应用总结
    spring整合strus2的Hellowworld
    责任链模式-对象行为型
  • 原文地址:https://www.cnblogs.com/ZengYunChun/p/6417927.html
Copyright © 2011-2022 走看看