在 ARM 架构的 Armbian 系统上搭建 Strudel 开发环境
概述Strudel 是一个基于 JavaScript 的实时编码音乐创作环境。本文将记录在 ARM 架构的 Armbian 系统上克隆、安装并启动 Strudel 项目的完整过程涵盖从 Git 克隆到pnpm dev启动开发服务器的关键步骤与注意事项。环境准备系统信息操作系统: Armbian (基于 Debian/Ubuntu 的 ARM 发行版)架构: ARM64 (aarch64)包管理器: pnpm v11.14.0项目路径:/sdb1/strudel/前置依赖确保系统已安装以下基础工具GitNode.js (建议 LTS 版本)pnpm (可通过npm install -g pnpm安装)步骤详解1. 克隆项目仓库使用 Git 克隆 Strudel 项目到本地目录gitclone 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/子目录中将其移动到当前目录根下# 进入项目目录cd/sdb1/strudel/# 查看目录内容ls# 输出: strudel# 移动所有文件到当前目录mvstrudel/*.# 再次查看确认文件已就位ls移动后目录结构应包含以下关键文件/目录packages/- 核心包源码website/- 网站前端package.json- 项目配置pnpm-workspace.yaml- pnpm 工作区配置README.md- 项目说明3. 安装依赖Strudel 使用 pnpm 工作区管理 35 个子包执行依赖安装pnpminstall安装过程关键信息依赖数量: 共 1,595 个包网络延迟: 部分包下载较慢出现多个超时 10 秒的警告平台特定包: 自动下载了 ARM64 架构的预编译二进制包tauri-apps/cli-linux-arm64-gnu2.2.7(8.13 MB)img/sharp-libvips-linux-arm641.0.4(7.09 MB)img/sharp-libvips-linuxmusl-arm641.0.4(7.13 MB)4. 处理构建脚本授权由于安全策略pnpm 默认阻止部分包的构建脚本执行[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: esbuild0.24.2, nx20.3.3, sharp0.33.5, tree-sitter-haskell0.23.1, tree-sitter0.21.1 Run pnpm approve-builds to pick which dependencies should be allowed to run scripts.需要手动批准这些关键包的构建pnpmapprove-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. 验证安装构建完成后再次运行安装以确保所有依赖就绪pnpminstall此时显示所有依赖已是最新状态仅执行了website包的 postinstall 脚本复制 WASM 文件到 public 目录。6. 启动开发服务器使用以下命令启动开发环境pnpmdev该命令实际执行的是npm run prestart- 预处理任务cd website npm run dev- 进入网站目录并启动开发服务器prestart任务会生成 API 文档npmrun jsdoc-json# 生成 doc.json 文件常见问题与解决方案1. 网络超时警告现象:[WARN] Request took 10067ms等警告原因: 国内访问 npm registry 可能较慢解决:使用国内镜像源pnpm config set registry https://registry.npmmirror.com或设置超时时间pnpm config set fetch-timeout 600002. 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 开发环境的主要挑战在于网络延迟- 可通过镜像源缓解构建脚本授权- 需要手动批准关键包本地编译耗时- tree-sitter 等包需要从源码编译整个过程约需 10-15 分钟主要耗时在依赖下载和本地编译。成功启动后可通过浏览器访问http://localhost:5173默认端口查看 Strudel 的实时编码界面。Strudel 作为音乐编程环境其技术栈涉及音频处理、实时编码、语法解析等多个领域适合对创意编程和计算机音乐感兴趣的开发者探索。꩜ welcomeYou 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:hit play - 2. change something - 3. hit updateIf 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.꩜ aboutstrudel 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