基于Scratch 3.0 本地客户端源码 部署流程

  1. 下载源码:https://github.com/LLK/scratch-www
  2. 进入目录:cd scratch-www
  3. 安装npm:sudo apt install npm
  4. 更新依赖包:npm install
    1. 报错[email protected] install:`node scripts/install.js` 
    2. 原因:node没安装
    3. 安装nodejs:sudo apt install nodejs-legacy
    4. 重新执行:npm install
  5. Build:npm run build
    1. 报错:Block-scoped declarations (let..) not yet supported outside strict mode
    2. 原因:node不是最新的
    3. 升级nodejs到最新:
    4. 安装工具n:sudo npm install n -g
    5. 安装lts版本:sudo n lts
    6. 重启终端
    7. 重新执行:npm run build
    8. 报错:Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(64)
    9. 原因:系统不支持
      1. https://github.com/sass/node-sass/releases/tag/v4.6.1(sass支持的node版本)
      2. 发现是node sass和node不兼容,当前版本是4.6.1支持最高的node是9,上一步升级的node到了10.13.0
    10. 降级nodejs到9:sudo n 9.11.2(因为代码中显示依赖sass4.6.1,因此尝试安装node9的最高版本9.11.2)
    11. 重启终端
    12. 重新执行:npm run build
    13. 报错:Node Sass could not find a binding for you current environment: Linux 64-bit with Node.js 9.x
      1. Found bindings for the following environments:
      2. Linux 64-bit with Node.js 4.x
    14. 原因:node更新后没有修改sass中的绑定
    15. 重新编译sass:npm rebuild node-sass --force
    16. 重新执行:npm run build
  6. Run:启动
    1. make translations
    2. npm start
  7. 当上面运行得到:Server listening on port 8333,表示启动成功

查看结果:查看本地scratch内容

  • 本机访问http://localhost:8333

  • 局域网访问http://192.168.3.155:8333(服务器IP地址)

 

 

 

欢迎感兴趣的朋友一起加QQ群交流学习。

猜你喜欢

转载自blog.csdn.net/suoxd123/article/details/84563583