ly525/luban-h5

#!zh: 安装问题汇总   #!en: issues summary about quick start

ly525 opened this issue · 5 comments

ly525 commented

依赖安装

依赖安装遇到的问题,99% 都能Google 搜索到
因此不再单独解答,有问题提issue,或者在下面评论

不欢迎如下行为

  1. 伸手党
  2. 一上来就贴张报错截图,啥都不说<node、yarn版本、用yarn 还是 npm 安装的依、是不是配置了镜像、有没有配置科学上网>

解决问题的主要思路(一定要看)!!!!!!!!!!!!!!

仔细阅读,贴出来的东西都是有用的

  1. 设置 npm 或 yarn 镜像,自动配置镜像脚本参见:https://github.com/ly525/luban-h5/blob/dev/deploy/mirror.sh,使用方法 拷贝下来,加上可执行权限,跑一下就行了。
    会自动把yarn和npm 配置成为淘宝的镜像源

  2. 鲁班的项目要用 yarn 安装依赖,不要用 npm !!!文档已经写的很清楚了

  3. 安装时可以装的上的,就是有些包在海外aws 上(原因看:https://github.com/ly525/luban-h5/blob/dev/deploy/mirror.sh 这里),导致时间很长。(可能超时了。自己弄个梯子,能直联 aws 就行了,h5-api 安装依赖耗时有时候会很长(平均耗时需要498.06s))

  4. 建议切换成联通的网络,联通的出口带宽多一些(相对移动和电信)

  5. 提问的时候,列出来自己的 node、yarn 版本,是否配置镜像等信息,提问的基本礼仪:https://zhuanlan.zhihu.com/p/19779979

补充资料

  1. 前端项目建议移除 node-sass 依赖,替换为 dart-sass;node-sass是古老的东西了,sass 官方都不用了
yarn add sass # 安装 dart-sass,dart-sass 现在是 sass 的主要实现。没有 binary 依赖

相关 issue

#92
#101

ly525 commented
node-pre-gyp info check checked for "/home/yqnj/source/h5/back-end/h5-api/node_modules/sqlite3/lib/binding/node-v67-linux-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.1/node-v67-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.1.1 and node@11.15.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error connect ETIMEDOUT 52.217.43.180:443 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
ly525 commented

问题1:安装依赖卡住

[5/5] Building fresh packages...
[1/7] ⡀ sqlite3
[-/7] ⡀ waiting...
[-/7] ⡀ waiting...
[-/7] ⡀ waiting...
error C:\website\luban-h5\back-end\h5-api\node_modules\sqlite3: Command failed

解决方案:
sqlite3相关的东西被墙在外面了,虽然已经改了淘宝镜像,还是翻墙下了sqlite3

其实只要配置下 sqlite3的二进制镜像就可以了,还是没看 mirror.sh 导致的
里面已经写的很清楚了

npm set node-sqlite3-binary-host-mirror "https://npm.taobao.org/mirrors"
npm set sqlite3-binary-site "https://npm.taobao.org/mirrors/sqlite3"
ly525 commented

后端无法启动 (Could Not Start API Server)

#!zh 现象:./luban-h5 init && ./luban-h5 start 之后,localhost:1337 无法访问
#!en behavior: ./luban-h5 init && ./luban-h5 start, localhost:1337 is not accessable

[2020-05-13T06:16:34.456Z] debug ⛔️ Server wasn't able to start properly.
[2020-05-13T06:16:34.458Z] error ReferenceError: URL is not defined

解决方案:

Node.js Version >= 10
更多请参见:strapi/strapi#2428

对了,鲁班的后端用的 strapi.js,后端开发过程中如果遇到什么问题

  1. 优先看鲁班的文档
  2. 搜索 strapi 的issues

果断安装了 yarn, 构建成功!
构建luban-h5

sqlite3按照上面的解决方案还是不行
image