Snap4Arduino BugList


#1

Snap4Arduino 是snap(scratch演化版本)与arduino 结合的开源项目

项目较为完整,准备用它做做二次开发,以下为填坑动作

一、 win10 安装unbuntu 子系统 并安装图形界面
https://blog.csdn.net/Aerry_ale/article/details/83050628

二、克隆 snap4arduino
cmder 下 bash 进入linux系统 git clone https://github.com/bromagosa/Snap4Arduino.git
注意要在linux 下git clone 不然windows 字符 回车换行 不一致

三、检测包
Before trying to build Snap4Arduino, make sure you have node, npm, sed, git, wget, zip and unzip installed in your system.
分别 node -v 等检查这些包是否已经安装

四、npm 找不到 解决方案

$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs
then i made some changes to my PATH in my ~/.profile
vim ~/.profile 点i 进行编辑 esc退出编辑 ctrl或alt +箭头移动光标
PATH="$HOME/bin:$HOME/.local/bin:/usr/bin:$PATH"
$ which npm
/usr/bin/npm

五、检查所有包
root@LAPTOP-PI2JTOFN:/mnt/d/cmder/Snap4Arduino# ./prepare --all

六、查看所有可编译的平台
root@LAPTOP-PI2JTOFN:/mnt/d/cmder/Snap4Arduino# ./build --help=platform
Usage: ./build --platform=TARGET [–run] [–deploy=URL --username=USERNAME [–dir=PATH]]

Available platforms are:
desktop/gnu/32
desktop/gnu/64
desktop/osx/64
desktop/win/32
desktop/win/64
embedded/cli
mobile/android
web/chromeos
web/chromium

Generic names are also accepted, such as:
desktop
desktop/gnu
mobile
this
all
root@LAPTOP-PI2JTOFN:/mnt/d/cmder/Snap4Arduino#

七、先编译一个windows 64bit 的程序看看

root@LAPTOP-PI2JTOFN:/mnt/d/cmder/Snap4Arduino# ./build --platform=desktop/win/64
Will build for the following platforms:

desktop/win/64

=======
Building for desktop/win/64…

Fetching Snap! sources…
Fetching Snap4Arduino examples…
Fetching Snap4Arduino libraries…
Fetching Snap4Arduino Costumes…
Fetching Snap4Arduino core…
Fetching platform-specific sources…
Fetching assets…
Fetching version file…
Running platform-specifig build script…

=======
Setting up Node dependencies…

‘environments/desktop/node_modules’ -> ‘tmp/node_modules’
‘environments/desktop/node_modules/bindings’ -> ‘tmp/node_modules/bindings’
‘environments/desktop/node_modules/bindings/package.json’ -> ‘tmp/node_modules/bindings/package.json’
‘environments/desktop/node_modules/bindings/bindings.js’ -> ‘tmp/node_modules/bindings/bindings.js’
‘environments/desktop/node_modules/bindings/README.md’ -> ‘tmp/node_modules/bindings/README.md’
‘environments/desktop/node_modules/object.assign’ -> ‘tmp/node_modules/object.assign’

八、出错 找不到npmbuilder
出错 npm WARN saveError ENOENT: no such file or directory, 找不到package.json

package.json 需要在哪个目录 就在哪里 建立
https://segmentfault.com/q/1010000012930521
首先,初始化项目,一路回车就行
npm init -f
接着安装依赖
npm install formidable --save

然后安装 npm-builder
npm install nw-builder --save-dev 注意安装到
environments/desktop/node_modules/ 下

另一个方案是建立environments/node_modules目录
再安装到这里,但是这里我没有测试

我修改build
#environments/node_modules/nw-builder/bin/nwbuild -v 0.34.5 -p $platform tmp -o releases/desktop
environments/desktop/node_modules/nw-builder/bin/nwbuild -v 0.34.5 -p $platform tmp -o releases/desktop

否则出现找不到npmbuild 情况。

最后执行 root@LAPTOP-PI2JTOFN:/mnt/d/cmder/snap4arduino# ./build --platform=desktop/win/64

至此,win10 X64 build success