Win10 scratch3 编译二次开发 buglist


#1

一、创建你的第一个Scratch3.0 Extension

https://blog.just4fun.site/create-first-Scratch3-Extension.html

  1. Installation Problem: Unexpected token { in cli.js
    nodejs 用最新版本安装

  2. info There appears to be trouble with your network connection. Retrying…
    改变镜像:yarn config set registry https://registry.npm.taobao.org

  3. npm install 安装慢 更换淘宝镜像
    npm config set registry https://registry.npm.taobao.org

  4. github git 慢
    https://www.jianshu.com/p/0493dcc15d6f
    https://www.ipaddress.com/

140.82.114.3 github.com
151.101.185.194 github.global.ssl.fastly.net
更改 hosts 重新刷新dns

D:\cmder\Scratch3
λ ipconfig /flushdns
Windows IP 配置
已成功刷新 DNS 解析缓存。

二、编译scratch3.0桌面程序(根据原创进行了一点修改)
https://blog.csdn.net/weixin_43513495/article/details/88633957

参考github 原始文档

cd scratch-gui (转到scratch-gui目录)
git clone HYPERLINK HYPERLINK https://github.com/LLK/scratch-desktop https://github.com/LLK/scratch-desktop HYPERLINK https://github.com/LLK/scratch-desktop https://github.com/LLK/scratch-desktop
npm install
yarn
yarn build
yarn start
用上句开启服务器 登录网址为HYPERLINK HYPERLINK http://127.0.0.1:8601 http://127.0.0.1:8601 HYPERLINK http://127.0.0.1:8601 http://127.0.0.1:8601
可以用词句开启运行webpack-dev-server --https,打开:HYPERLINK HYPERLINK https://127.0.0.1:8601/ https://127.0.0.1:8601/ HYPERLINK https://127.0.0.1:8601/ https://127.0.0.1:8601/ 如果开启正常scratch3回到cmder进行下一步
ctrl+c 关闭服务器
set BUILD_MODE=dist 7.1)set STATIC_PATH=static
npm run build (犯了个错误 build后面加了个空格 出现 npm err!missing script:build 去掉后正常)
cd scratch-desktop
yarn
npm install
npm run fetch
将scratch-gui下面的dist拷贝到 scratch-desktop/node_modules/scratch-gui/
npm start
npm run dist //制作打包的版本
或者 npm run dist:dir //模拟打包就是半打包


如果上面npm 安装运行问题, 使用下面yarn的方式

scratch-desktop

配置好命令环境
windows用户
安装nodejs.
使用cmder,而不是cmd。
以下为cmder 命令
node -v # v10.15.0. v11.7.0也没问题 , 推荐使用n来管理nodejs版本
npm install -g yarn
npm install -g webpack
npm install -g webpack-dev-server
mkdir Scratch3 #
cd Scratch3
git clone https://github.com/LLK/scratch-gui
cd scratch-gui
yarn install

找不到资源
D:\cmder\scratch
λ git checkout scratch-gui
fatal: not a git repository (or any of the parent directories): .git

从原始地址克隆
D:\cmder\Scratch3
λ git clone https://github.com/LLK/scratch-gui.git
Cloning into ‘scratch-gui’…
remote: Enumerating objects: 65, done.
remote: Counting objects: 100% (65/65), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 68200 (delta 31), reused 19 (delta 8), pack-reused 68135
Receiving objects: 100% (68200/68200), 1.03 GiB | 2.50 MiB/s, done.
Resolving deltas: 100% (50408/50408), done.
Checking out files: 100% (809/809), done.

切换分支
D:\cmder\Scratch3\scratch-gui (develop -> origin) (scratch-gui@0.1.0)
λ git checkout scratch-desktop
Switched to a new branch ‘scratch-desktop’
Branch ‘scratch-desktop’ set up to track remote branch ‘scratch-desktop’ from ‘origin’.

安装依赖文件
D:\cmder\Scratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ yarn install

yarn link

set BUILD_MODE=dist
set STATIC_PATH=static
yarn build
cd…
git clone https://github.com/LLK/scratch-desktop.git
cd scratch-desktop
yarn install
yarn link scratch-gui
npm run fetch
yarn start
yarn run dist

参考
https://blog.just4fun.site/create-first-Scratch3-Extension.html
https://blog.csdn.net/weixin_43513495/article/details/88633957

制作一个插件
注意日文翻译后代码是添加了空格,原网页复制才能保证路径文件名正确。


scratch desktop build help scratch桌面版编译指南


修改gui过程中发现,多语言版本需要下载其他代码,所以一次性将所有的scratch都fork
重新编译,只做了一份指南

xc:scratch 是steam教育重要的一环,也是锻炼逻辑思维能力的好工具,从二次开发我们就要训练逻辑思维了:)

官方推荐vscode 那么我们就用这个。

本文件查看方式(vscode)
点本文件右上角 分栏
安装markdown all one 插件 ctrl+shift+V 可以切换到预览视图或者ctrl+k 输入v 打开预览markdown窗口

关于作者

xc:我是知乎向导,如果关于这个有技术问题可以加微信交流xc32640110

因为我写一些入门的文档,根据读者反馈,深知跳跃式的指导文件是个大问题,太多的疑问,初学者是找不到路径的。step by step 一步步清晰的来,无论看起来我的写法有多low,让看到的人明确思路过程个人觉得非常重要,因为目前h5开发之类,需要对整体的把控,各种工具、配置相对繁琐,所以更有必要写清楚。

xc:玩这个要有福尔摩斯的推理能力,我们试着边实践、边推演的解决问题!做为大侦探我会友情提供线索:)

参考:Win10 scratch3 编译二次开发 buglist
参考:微信收藏 scratch-desktop (微信:xc32640110)

VSCode 终端执行 或者cmder(我将终端更换为了cmder)


d:\cmder\JScratch3\scratch-gui (develop -> origin) (scratch-gui@0.1.0)
λ cd ..

d:\cmder\JScratch3  
λ dir
 驱动器 D 中的卷没有标签。
 卷的序列号是 CE48-0525

 d:\cmder\JScratch3 的目录

2019/09/29  08:36    <DIR>          .
2019/09/29  08:36    <DIR>          ..
2019/09/29  08:36    <DIR>          .history
2019/09/29  08:36               399 JScartch3.code-workspace
2019/09/29  08:47    <DIR>          scratch-audio
2019/09/29  08:31    <DIR>          scratch-blocks
2019/09/29  08:49    <DIR>          scratch-gui
2019/09/29  08:31    <DIR>          scratch-l10n
2019/09/29  08:26    <DIR>          scratch-paint
2019/09/29  08:29    <DIR>          scratch-render
2019/09/29  08:28    <DIR>          scratch-storage
2019/09/29  08:31    <DIR>          scratch-svg-renderer
2019/09/29  08:32    <DIR>          scratch-vm
2019/09/29  08:28    <DIR>          scratch-www
               1 个文件            399 字节
              13 个目录 28,662,923,264 可用字节

d:\cmder\JScratch3  
λ git clone https://github.com/sxcem/scratch-desktop.git
Cloning into 'scratch-desktop'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 819 (delta 23), reused 25 (delta 9), pack-reused 774 eceiving objects:  98% (803/819), 896.01 KiB | 788.00 KiB/s     
Receiving objects: 100% (819/819), 1.21 MiB | 763.00 KiB/s, done.
Resolving deltas: 100% (488/488), done.

d:\cmder\JScratch3  
λ cd scratch-gui

d:\cmder\JScratch3\scratch-gui (develop -> origin) (scratch-gui@0.1.0)
λ git checkout scratch-desktop
Switched to a new branch 'scratch-desktop'
yarn install v1.17.3
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning core-js@2.5.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
warning react > fbjs > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
warning react-dom@16.2.0: This version of react-dom/server contains a minor vulnerability. Please update react-dom to 16.2.1 or 16.[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.19.0", while you're on "1.17.3".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Done in 127.78s.

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ set BUILD_MODE=dist

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ set STATIC_PATH=static

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ yarn build
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.19.0", while you're on "1.17.3".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Done in 127.78s.

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ set BUILD_MODE=dist

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ set STATIC_PATH=static

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ yarn build
yarn run v1.17.3
$ npm run clean && webpack --progress --colors --bail

> scratch-gui@0.1.0 clean d:\cmder\JScratch3\scratch-gui
> rimraf ./build && mkdirp build && rimraf ./dist && mkdirp dist

56% [1] building 363/411 modules 48 active ...?ref--4!d:\cmder\JScratch3\scratch-gui\node_modules\scratch-vm\src\engine\comment.js 
61% [1] building 400/442 modules 42 active ...ratch3\scratch-gui\node_modules\scratch-vm\src\extension-support\extension-worker.js (

error1-xc:
60% [1] building 407/457 modules 50 active ...ratch3\scratch-gui\node_modules\scratch-vm\src\extension-support\extension-worker.js (
node:15044) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
68% [1] building 672/722 modules 50 active d:\cmder\JScratch3\scratch-gui\node_modules\jszip\lib\signature.jsModuleNotFoundError: Module not found: Error: Can't resolve '../extensions/scratch3_ev3' in 'd:\cmder\JScratch3\scratch-gui\node_modules\scratch-vm\src\extension-support'
    at factory.create (d:\cmder\JScratch3\scratch-gui\node_modules\webpack\lib\Compilation.js:925:10)
    at factory (d:\cmder\JScratch3\scratch-gui\node_modules\webpack\lib\NormalModuleFactory.js:401:22)
    at resolver (d:\cmder\JScratch3\scratch-gui\node_modules\webpack\lib\NormalModuleFactory.js:130:21)
    at asyncLib.parallel (d:\cmder\JScratch3\scratch-gui\node_modules\webpack\lib\NormalModuleFactory.js:224:22)
    at d:\cmder\JScratch3\scratch-gui\node_modules\neo-async\async.js:2830:7

考虑是scratch-vm 内置的文件问题  不适用内部 scratch-vm 关联到clone 源码scratch-vm 再次测试
前期未出问题:原因是这个动作提前做了 
参考:https://blog.just4fun.site/create-first-Scratch3-Extension.html
参考:https://forums.codelab.club/t/topic/291

继续
d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ cd ..

d:\cmder\JScratch3  
λ dir
 驱动器 D 中的卷没有标签。
 卷的序列号是 CE48-0525

 d:\cmder\JScratch3 的目录

2019/09/29  09:05    <DIR>          .
2019/09/29  09:05    <DIR>          ..
2019/09/29  08:36    <DIR>          .history
2019/09/29  09:05               437 JScartch3.code-workspace
2019/09/29  08:47    <DIR>          scratch-audio
2019/09/29  08:31    <DIR>          scratch-blocks
2019/09/29  09:05    <DIR>          scratch-desktop
2019/09/29  09:14    <DIR>          scratch-gui
2019/09/29  08:31    <DIR>          scratch-l10n
2019/09/29  08:26    <DIR>          scratch-paint
2019/09/29  08:29    <DIR>          scratch-render
2019/09/29  08:28    <DIR>          scratch-storage
2019/09/29  08:31    <DIR>          scratch-svg-renderer
2019/09/29  08:32    <DIR>          scratch-vm
2019/09/29  08:28    <DIR>          scratch-www
               1 个文件            437 字节
              14 个目录 28,261,564,416 可用字节

d:\cmder\JScratch3  
λ cd scratch-vm

d:\cmder\JScratch3\scratch-vm (develop -> origin) (scratch-vm@0.2.0)
λ dir
 驱动器 D 中的卷没有标签。
 卷的序列号是 CE48-0525

 d:\cmder\JScratch3\scratch-vm 的目录

2019/09/29  08:32    <DIR>          .
2019/09/29  08:32    <DIR>          ..
2019/09/29  08:32               162 .editorconfig
2019/09/29  08:32                58 .eslintignore
2019/09/29  08:32                78 .eslintrc.js
2019/09/29  08:32               853 .gitattributes
2019/09/29  08:32    <DIR>          .github
2019/09/29  08:32               174 .gitignore
2019/09/29  08:32               433 .jsdoc.json
2019/09/29  08:32               281 .npmignore
2019/09/29  08:32             1,864 .travis.yml
2019/09/29  08:32    <DIR>          .tx
2019/09/29  08:32    <DIR>          docs
2019/09/29  08:32             1,508 LICENSE
2019/09/29  08:32           506,916 package-lock.json
2019/09/29  08:32             3,097 package.json
2019/09/29  08:32             4,125 README.md
2019/09/29  08:32    <DIR>          src
2019/09/29  08:32    <DIR>          test
2019/09/29  08:32               319 TRADEMARK
2019/09/29  08:32             4,503 webpack.config.js
              14 个文件        524,371 字节
               7 个目录 28,261,564,416 可用字节

d:\cmder\JScratch3\scratch-vm (develop -> origin) (scratch-vm@0.2.0)
λ yarn install
yarn install v1.17.3
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning scratch-parser > jszip > core-js@2.3.0: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
warning scratch-sb1-converter > text-encoding@0.7.0: no longer maintained
warning text-encoding@0.7.0: no longer maintained
warning format-message-cli > eslint > file-entry-cache > flat-cache > circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
warning scratch-render > scratch-storage > text-encoding@0.7.0: no longer maintained
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
$ in-publish && npm run build || not-in-publish
Done in 66.69s.

d:\cmder\JScratch3\scratch-vm (develop -> origin) (scratch-vm@0.2.0) 
λ yarn link
yarn link v1.17.3
warning There's already a package called "scratch-vm" registered. This command has had no effect. If this command was run in another folder with the same name, the other folder is still linked. Please run yarn unlink in the other folder if you want to register this folder.
Done in 0.22s.

d:\cmder\JScratch3\scratch-vm (develop -> origin) (scratch-vm@0.2.0) 
λ yarn add uglifyjs-webpack-plugin
yarn add v1.17.3
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["scratch-svg-renderer@latest"] is trying to unpack in the same destination "C:\\Users\\sxcch\\AppData\\Local\\Yarn\\Cache\\v4\\npm-scratch-svg-renderer-0.2.0-prerelease.20190822202608-2d6d6cccae52b4effdd255638cf2b9a4181c5ec1\\node_modules\\scratch-svg-renderer" as pattern ["scratch-svg-renderer@0.2.0-prerelease.20190822202608"]. This could result in non-deterministic behavior, skipping.
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning "uglifyjs-webpack-plugin" is already in "devDependencies". Please remove existing entry first before adding it to "dependencies".
success Saved 1 new dependency.
info Direct dependencies
└─ uglifyjs-webpack-plugin@2.2.0
info All dependencies
$ in-publish && npm run build || not-in-publish
Done in 16.84s.

d:\cmder\JScratch3\scratch-vm (develop -> origin) (scratch-vm@0.2.0)
λ yarn run watch
yarn run v1.17.3
$ webpack --progress --colors --watch
10% [2] building 0/0 modules 0 active
webpack is watching the files…

......
    Child worker:
                                     Asset      Size  Chunks                         Chunk Names
            829006d1e432e3295097.worker.js  6.16 KiB    main  [emitted] [immutable]  main
        829006d1e432e3295097.worker.js.map  6.19 KiB    main  [emitted] [dev]        main
        Entrypoint main = 829006d1e432e3295097.worker.js 829006d1e432e3295097.worker.js.map
           1 module

xc:到这里scratch-vm 运行成功

npm start
http://127.0.0.1:8073/playground/

就可以打开 vm的一个测试网站
出现scratch vm benchmark

xc:这是新开一个terminal

cd scratch-gui
yarn link scratch-vm
yarn
yarn build

然后打开浏览器
输入 127.0.0.1:8601

xc:亲爱的猫咪出现了 啵一个:)

大侦探的第一个推理是正确的,scratch-gui 直接编译有问题,少文件,先编译scratch-vm 然后gui link vm。

现在实现的是本地网页版的scratch

xc:接着我们来做desktop 本地桌面版

注意运行 cmder 需要终止网站运行等,ctrl+c即可

终止网站运行

i 「wdm」: Compiled successfully.
终止批处理操作吗(Y/N)? y

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0) 
λ yarn link
yarn link v1.17.3
warning There's already a package called "scratch-gui" registered. This command has had no effect. If this command was run in another folder with the same name, the other folder is still linked. Please run yarn unlink in the other folder if you want to register 
this folder.
Done in 0.18s.

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0) 
λ set BUILD_MODE=dist

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0)
λ set STATIC_PATH=static

d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0) 
λ yarn build

xc:显示下面的内容标识成功

        + 2077 hidden modules
    Child worker:
                                     Asset      Size  Chunks                         Chunk Names
            2410d9e4a27c2e539c72.worker.js  6.45 KiB    main  [emitted] [immutable]  main
        2410d9e4a27c2e539c72.worker.js.map  6.28 KiB    main  [emitted] [dev]        main
        Entrypoint main = 2410d9e4a27c2e539c72.worker.js 2410d9e4a27c2e539c72.worker.js.map
           1 module
    Child worker:
                          Asset      Size  Chunks                   Chunk Names
            extension-worker.js  53.7 KiB    main  [emitted]        main
        extension-worker.js.map  42.8 KiB    main  [emitted] [dev]  main
        Entrypoint main = extension-worker.js extension-worker.js.map
        [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]
            + 19 hidden modules
Done in 108.29s.

xc: 我们现在开始准备编译桌面版
d:\cmder\JScratch3\scratch-gui (scratch-desktop -> origin) (scratch-gui@0.1.0) 
λ cd ..

d:\cmder\JScratch3  
λ cd scratch-desktop

d:\cmder\JScratch3\scratch-desktop (develop -> origin) (scratch-desktop@3.6.0)
λ yarn install
yarn install v1.17.3
info No lockfile found.
rsion of core-js@2.
warning react-dom@16.2.0: This version of react-dom/server contains a minor vulnerability. Please update react-dom to 16.2.1 or 16.4.2+. Learn more: https://fb.me/cve-2018-6341
warning react-intl > intl-relativeformat@2.2.0: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#migration-guide'
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > react-intl@2.4.0" has unmet peer dependency "prop-types@^15.5.4".
[4/4] Building fresh packages...
[1/2] ⠂ core-js
success Saved lockfile.
Done in 530.94s.

xc: 现在我们把desktop link gui 

d:\cmder\JScratch3\scratch-desktop (develop -> origin) (scratch-desktop@3.6.0)
λ yarn link scratch-gui
yarn link v1.17.3
success Using linked package for "scratch-gui".
Done in 0.65s.

xc:现在我们下载图片等资源包
npm run fetch  这个用法不是很了解,需要学习

d:\cmder\JScratch3\scratch-desktop (develop -> origin) (scratch-desktop@3.6.0) 
λ npm run fetch

> scratch-desktop@3.6.0 fetch d:\cmder\JScratch3\scratch-desktop
> rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js

Total library assets: 1287
Fetched //cdn.assets.scratch.mit.edu/internalapi/asset/7be1f5b3e682813dac1f297e52ff7dca.svg/get/
Fetched //cdn.assets.scratch.mit.edu/internalapi/asset/825d9b54682c406215d9d1f98a819449.svg/get/
Fetched //cdn.assets.scratch.mit.edu/internalapi/asset/e494c4f44897d94e0541f7036a302449.svg/get/
...
Fetched //cdn.assets.scratch.mit.edu/internalapi/asset/199b30c8b4fe0642e849924bd1e1b463.wav/get/
Fetch succeeded.
Shutting down 5 agents.

xc: 到此步我们桌面的源码也编译配置完成。

开始运行测试

d:\cmder\JScratch3\scratch-desktop (develop -> origin) (scratch-desktop@3.6.0)
λ yarn start
yarn run v1.17.3
$ electron-webpack dev --bail --display-error-details --env.minify=false
┏ Renderer -------------------

  AttachConsole failed with error 6: �������

┗ ----------------------------
Targeting Electron v4.2.11
Module "main" building in production mode? false
┏ Renderer -------------------

  Targeting Electron v4.2.11
  Module "renderer" building in production mode? false

┗ ----------------------------
┏ Renderer -------------------

  i 「wds」: Project is running at http://localhost:9080/
  i 「wds」: webpack output is served from /
  i 「wds」: Content not from webpack is served from d:\cmder\JScratch3\scratch-desktop\static, d:\cmder\JScratch3\scratch-desktop\dist\renderer-dll

┗ ----------------------------
┏ Main -----------------------

  Hash: ffc14c2490a01b4c1797
  Version: webpack 4.41.0
  Time: 3743ms
  Built at: 2019-09-29 10:48:37 AM
        Asset      Size  Chunks                   Chunk Names
      main.js  3.48 MiB    main  [emitted]        main
  main.js.map  29.3 KiB    main  [emitted] [dev]  main
  Entrypoint main = main.js main.js.map
  [0] multi ./node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main/index.js 40 bytes {main} [built]
  [./node_modules/electron-webpack/out/electron-main-hmr/main-hmr.js] 546 bytes {main} [built]
  [./node_modules/lodash.defaultsdeep/index.js] 51.5 KiB {main} [built]
  [./package.json] 2.36 KiB {main} [built]
  [./src/main/FileFilters.js] 3.02 KiB {main} [built]
  [./src/main/MacOSMenu.js] 828 bytes {main} [built]
  [./src/main/ScratchDesktopTelemetry.js] 5.45 KiB {main} [built]
  [./src/main/index.js] 7.03 KiB {main} [built]
  [./src/main/telemetry/TelemetryClient.js] 9.53 KiB {main} [built]
  [electron] external "electron" 42 bytes {main} [built]
  [electron-devtools-installer] external "electron-devtools-installer" 42 bytes {main} [built]
  [electron-webpack/out/electron-main-hmr/HmrClient] external "electron-webpack/out/electron-main-hmr/HmrClient" 42 bytes {main} [built]
  [path] external "path" 42 bytes {main} [built]
  [source-map-support/source-map-support.js] external "source-map-support/source-map-support.js" 42 bytes {main} [built]
  [url] external "url" 42 bytes {main} [built]
      + 215 hidden modules

  WARNING in ./node_modules/write-file-atomic/index.js
  Module not found: Error: Can't resolve 'worker_threads' in 'd:\cmder\JScratch3\scratch-desktop\node_modules\write-file-atomic'   
   @ ./node_modules/write-file-atomic/index.js
   @ ./node_modules/conf/index.js
   @ ./node_modules/electron-store/index.js
   @ ./src/main/telemetry/TelemetryClient.js
   @ ./src/main/ScratchDesktopTelemetry.js
   @ ./src/main/index.js
   @ multi ./node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main/index.js

┗ ----------------------------
┏ Renderer -------------------

  × 「wdm」: Hash: 65253b58611e5b2bf160
  Version: webpack 4.41.0
  Time: 3054ms
  Built at: 2019-09-29 10:48:39 AM
   12 assets
  Entrypoint renderer = renderer.js renderer.js.map
  [1] multi (webpack)-dev-server/client?http://localhost:9080 (webpack)/hot/dev-server.js css-hot-loader/hotModuleReplacement ./src/renderer/index.js 64 bytes {renderer} [built]
  [./node_modules/css-hot-loader/hotModuleReplacement.js] 3.05 KiB {renderer} [built]
  [./node_modules/lodash/debounce.js] 5.96 KiB {renderer} [built]
  [./node_modules/normalize-url/index.js] 3.85 KiB {renderer} [built]
  [./node_modules/strip-ansi/index.js] 161 bytes {renderer} [built]
  [./node_modules/webpack-dev-server/client/index.js?http://localhost:9080] (webpack)-dev-server/client?http://localhost:9080 4.29 
KiB {renderer} [built]
  [./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {renderer} [built]
  [./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {renderer} [built]
  [./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.89 KiB {renderer} [built]
  [./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {renderer} [built]    
  [./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {renderer} 
[built]
  [./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {renderer} [built]
  [./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {renderer} [built]
  [./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js 1.59 KiB {renderer} [built]
  [./src/renderer/index.js] 364 bytes {renderer} [built]
      + 93 hidden modules

  ERROR in ./src/renderer/app.jsx
  Module not found: Error: Can't resolve 'scratch-gui' in 'd:\cmder\JScratch3\scratch-desktop\src\renderer'
   @ multi css-hot-loader/hotModuleReplacement ./src/renderer/index.js
  Child html-webpack-plugin for "index.html":
       1 asset
      Entrypoint undefined = index.html
      [./node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html] 796 bytes {0} [built] 
  Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-2!src/renderer/app.css:
      Entrypoint mini-css-extract-plugin = *
      [./node_modules/css-loader/dist/cjs.js?!./src/renderer/app.css] ./node_modules/css-loader/dist/cjs.js??ref--6-2!./src/renderer/app.css 471 bytes {mini-css-extract-plugin} [built]
      [./node_modules/css-loader/dist/runtime/api.js] 2.61 KiB {mini-css-extract-plugin} [built]

┗ ----------------------------
┏ Renderer -------------------

  i 「wdm」: Failed to compile.
  i 「wdm」: Compiling...

┗ ----------------------------

xc:出现错误,碰到了源码的一个坑,还好我已经解决了
做下面这个动作 将scratch-gui下面的dist拷贝到 scratch-desktop/node_modules/scratch-gui/

npm start 启动成功

npm run dist //制作打包的版本

或者 npm run dist:dir //模拟打包就是半打包