1、下载源码:https://github.com/LLK/scratch-www
2、进入目录:cd scratch-www
3、安装npm:sudo apt install npm
4、更新依赖包:npm install
报错:node-sass@4.6.1 install:`node scripts/install.js`
原因:node没安装
安装nodejs:sudo apt install nodejs-legacy
重新执行:npm install
5、Build:npm run build
需要安装git。
报错后需要git init git add . git config --global user.name "Your Name" git config --global user.email "email@example.com" git commit -m "添加项目"
报错:Block-scoped declarations (let..) not yet supported outside strict mode
原因:node不是最新的
升级nodejs到最新:
安装工具n:sudo npm install n -g
安装lts版本:sudo n lts
重启终端
重新执行:npm run build
报错:Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(64)
原因:系统不支持
https://github.com/sass/node-sass/releases/tag/v4.6.1(sass支持的node版本)
发现是node sass和node不兼容,当前版本是4.6.1支持最高的node是9,上一步升级的node到了10.13.0
降级nodejs到9:sudo n 9.11.2(因为代码中显示依赖sass4.6.1,因此尝试安装node9的最高版本9.11.2)
重启终端
重新执行:npm run build
报错:Node Sass could not find a binding for you current environment: Linux 64-bit with Node.js 9.x
Found bindings for the following environments:
Linux 64-bit with Node.js 4.x
原因:node更新后没有修改sass中的绑定
重新编译sass:npm rebuild node-sass --force
重新执行:npm run build
Run:启动
6、make translations
7、npm start
当上面运行得到:Server listening on port 8333,表示启动成功
查看结果:查看本地scratch内容
本机访问http://localhost:8333
局域网访问http://192.168.3.155:8333(服务器IP地址)