下载node.js
sudo apt-get install nodejs
下载npm
sudo apt-get install npm
安装node.js
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
更新库文件
sudo apt-get update
更新软件
sudo apt-get upgrade
手动安装魔镜,首先克隆库
git clone https://github.com/MichMich/MagicMirror
进入存储库
cd MagicMirror/
安装应用程序(时间较长,根据树莓派版本时间长短不同,不要打断)
npm install
# 国内用户建议用下面安装
npm install --registry=https://registry.npm.taobao.org --loglevel=silly
有时因为网络原因,导致一些组件下载失败,在npm install的时候,如果中途退出或者出错,最好将node_modules文件夹删掉,重新执行npm install
复制配置示例文件
cp config/config.js.sample config/config.js
启动应用程序
npm run start
或服务器启动(网页)
npm run server
另外有魔镜安装一键脚本(适用网络好的)
bash -c " $( curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh ) "
一键脚本显示这样才是正在安装,不显示建议按照上述步骤手动安装
旋转屏幕
修改启动配置文件
sudo nano /boot/config.txt
添加以下的某一行:
display_rotate=0 不旋转 Normal
display_rotate=1 转90 degrees
display_rotate=2 转180 degrees
display_rotate=3 转270 degrees
display_rotate=0x10000 左右翻转horizontal flip
display_rotate=0x20000 上下翻转vertical flip