在 ARM 架构的 Armbian 系统上搭建 Strudel 开发环境

概述

Strudel 是一个基于 JavaScript 的实时编码音乐创作环境。本文将记录在 ARM 架构的 Armbian 系统上克隆、安装并启动 Strudel 项目的完整过程,涵盖从 Git 克隆到 pnpm dev 启动开发服务器的关键步骤与注意事项。

环境准备

系统信息

  • 操作系统: Armbian (基于 Debian/Ubuntu 的 ARM 发行版)
  • 架构: ARM64 (aarch64)
  • 包管理器: pnpm v11.14.0
  • 项目路径 : /sdb1/strudel/

前置依赖

确保系统已安装以下基础工具:

  • Git
  • Node.js (建议 LTS 版本)
  • pnpm (可通过 npm install -g pnpm 安装)

步骤详解

1. 克隆项目仓库

使用 Git 克隆 Strudel 项目到本地目录:

bash 复制代码
git clone https://github.com/alfredojarry/strudel.git

克隆过程显示项目体积较大(约 156 MB),包含 38,414 个对象:

复制代码
Cloning into 'strudel'...
remote: Enumerating objects: 38414, done.
remote: Counting objects: 100% (13532/13532), done.
remote: Compressing objects: 100% (4106/4106), done.
remote: Total 38414 (delta 9844), reused 9426 (delta 9426), pack-reused 24882 (from 1)
Receiving objects: 100% (38414/38414), 156.15 MiB | 7.97 MiB/s, done.
Resolving deltas: 100% (27741/27741), done.

2. 调整目录结构

克隆后项目文件位于 strudel/ 子目录中,将其移动到当前目录根下:

bash 复制代码
# 进入项目目录
cd /sdb1/strudel/

# 查看目录内容
ls
# 输出: strudel

# 移动所有文件到当前目录
mv strudel/* .

# 再次查看,确认文件已就位
ls

移动后目录结构应包含以下关键文件/目录:

  • packages/ - 核心包源码
  • website/ - 网站前端
  • package.json - 项目配置
  • pnpm-workspace.yaml - pnpm 工作区配置
  • README.md - 项目说明

3. 安装依赖

Strudel 使用 pnpm 工作区管理 35 个子包,执行依赖安装:

bash 复制代码
pnpm install

安装过程关键信息:

  • 依赖数量: 共 1,595 个包
  • 网络延迟: 部分包下载较慢(出现多个超时 10+ 秒的警告)
  • 平台特定包 : 自动下载了 ARM64 架构的预编译二进制包
    • @tauri-apps/cli-linux-arm64-gnu@2.2.7 (8.13 MB)
    • @img/sharp-libvips-linux-arm64@1.0.4 (7.09 MB)
    • @img/sharp-libvips-linuxmusl-arm64@1.0.4 (7.13 MB)

4. 处理构建脚本授权

由于安全策略,pnpm 默认阻止部分包的构建脚本执行:

复制代码
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: 
esbuild@0.24.2, nx@20.3.3, sharp@0.33.5, 
tree-sitter-haskell@0.23.1, tree-sitter@0.21.1
Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.

需要手动批准这些关键包的构建:

bash 复制代码
pnpm approve-builds

在交互界面中选择所有需要构建的包:

  • esbuild (JavaScript 打包工具)
  • nx (构建系统)
  • sharp (图像处理库)
  • tree-sitter (语法解析器)
  • tree-sitter-haskell (Haskell 语法支持)

构建耗时统计:

  • tree-sitter: 3分25.4秒(最耗时)
  • esbuild: 662毫秒
  • sharp: 530毫秒
  • nx: 2.8秒
  • tree-sitter-haskell: 38.9秒

5. 验证安装

构建完成后,再次运行安装以确保所有依赖就绪:

bash 复制代码
pnpm install

此时显示所有依赖已是最新状态,仅执行了 website 包的 postinstall 脚本(复制 WASM 文件到 public 目录)。

6. 启动开发服务器

使用以下命令启动开发环境:

bash 复制代码
pnpm dev

该命令实际执行的是:

  1. npm run prestart - 预处理任务
  2. cd website && npm run dev - 进入网站目录并启动开发服务器

prestart 任务会生成 API 文档:

bash 复制代码
npm run jsdoc-json
# 生成 doc.json 文件

常见问题与解决方案

1. 网络超时警告

现象 : [WARN] Request took 10067ms 等警告

原因 : 国内访问 npm registry 可能较慢

解决:

  • 使用国内镜像源:pnpm config set registry https://registry.npmmirror.com
  • 或设置超时时间:pnpm config set fetch-timeout 60000

2. ARM 架构兼容性

现象 : 自动下载了 -linux-arm64- 后缀的二进制包

说明: pnpm 能正确识别 ARM 架构并下载对应预编译包,无需额外配置

3. 构建脚本被阻止

现象 : [ERR_PNPM_IGNORED_BUILDS] 错误

原因 : pnpm 默认安全策略

解决 : 按提示运行 pnpm approve-builds 并选择需要构建的包

4. tree-sitter 构建耗时过长

原因 : tree-sitter 需要从源码编译本地扩展

优化: 可考虑提前安装系统级的 tree-sitter 开发库

项目结构说明

复制代码
strudel/
├── packages/          # 核心功能包
│   ├── core/         # 核心引擎
│   ├── mini/         # 精简版
│   ├── tonal/        # 音乐理论
│   ├── transpiler/   # 代码转换
│   ├── webaudio/     # Web Audio 集成
│   └── xen/          # 调度器
├── website/          # 官方网站
├── examples/         # 示例代码
├── test/            # 测试文件
└── src-tauri/       # Tauri 桌面应用

总结

在 ARM 架构的 Armbian 系统上搭建 Strudel 开发环境的主要挑战在于:

  1. 网络延迟 - 可通过镜像源缓解
  2. 构建脚本授权 - 需要手动批准关键包
  3. 本地编译耗时 - tree-sitter 等包需要从源码编译

整个过程约需 10-15 分钟(主要耗时在依赖下载和本地编译)。成功启动后,可通过浏览器访问 http://localhost:5173(默认端口)查看 Strudel 的实时编码界面。

Strudel 作为音乐编程环境,其技术栈涉及音频处理、实时编码、语法解析等多个领域,适合对创意编程和计算机音乐感兴趣的开发者探索。

꩜ welcome

You have found strudel, a new live coding platform to write dynamic music pieces in the browser! It is free and open-source and made for beginners and experts alike. To get started:

  1. hit play - 2. change something - 3. hit update
    If you don't like what you hear, try shuffle!

To learn more about what this all means, check out the interactive tutorial. Also feel free to join the tidalcycles discord channel to ask any questions, give feedback or just say hello.

꩜ about

strudel is a JavaScript version of tidalcycles, which is a popular live coding language for music, written in Haskell. Strudel is free/open source software: you can redistribute and/or modify it under the terms of the GNU Affero General Public License. You can find the source code at github. You can also find licensing info for the default sound banks there. Please consider to support this project to ensure ongoing development 💖

相关推荐
程序员JerrySUN21 小时前
Jetson 刷机深度解析:flash.sh vs l4t_initrd_flash.sh(含安全与磁盘加密对比)
linux·网络·arm开发·安全·系统安全
执迷不悟8231 天前
ARM--汇编指令
汇编·arm开发
2601_954706491 天前
算力上云革新移动终端:ARM 虚拟化云手机底层原理、API 自动化实战与 2026 选型全解
arm开发·智能手机·自动化
CHY_1281 天前
Arm Ethos‑U65:YOLOv8n 模型准备与 Vela 编译
arm开发·人工智能·yolo·目标检测
Dlrb12112 天前
ARM架构---Cortex系列寄存器,重要内部模块,工作模式,异常处理等
arm开发·arm·指令集·arm工作模式·soc片上系统·ram与rom
Dlrb12112 天前
ARM指令集---汇编指令集的学习与应用:C程序与汇编的相互调用,处理器工作模式的改变等
汇编·arm开发·arm··arm指令集·汇编指令
治愈系贝壳2 天前
ARM ---day1
linux·arm开发·学习
zlinear数据采集卡3 天前
从万用表的6步调零到硅片级微秒自校准:硬核拆解LHAMP188的宽压轨到轨与零漂移实战
arm开发·stm32·单片机·嵌入式硬件·fpga开发
CHY_1283 天前
Arm Ethos-U65 介绍(1) 架构、数据格式与算子
arm开发·人工智能·机器学习·npu