NPM 安装后,搜索失败
Closed this issue · 7 comments
设备环境:Android 13,ARM64,Termux 0.118
Node 版本:18.4.0
在前端搜索界面输入字符搜索,报错如下:
ERROR catch error Cannot read properties of null (reading 'map')
at searchSongFromAllPlatform (backend/src/service/media_fetcher/index.js:120:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async searchSongsWithKeyword (backend/src/service/search_songs/index.js:6:24)
at async search (backend/src/handler/songs.js:22:17)
ℹ searchSong with {"0":{"keyword":"十年"}}
ℹ cmdStr: /data/data/com.termux/files/home/melody/backend/src/service/media_fetcher/../../../bin/media-get -k " 十年" --searchType="song" -m --infoFormat=json -l silence
/data/data/com.termux/files/home/melody/backend/src/service/media_fetcher/../../../bin/media-get [
'-k',
'"十年"',
'--searchType="song"',
'-m',
'--infoFormat=json',
'-l',
'silence'
]
ℹ -------
ℹ 0
ℹ -------
ERROR catch error Cannot read properties of null (reading 'map')
at searchSongFromAllPlatform (backend/src/service/media_fetcher/index.js:120:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async searchSongsWithKeyword (backend/src/service/search_songs/index.js:6:24)
at async search (backend/src/handler/songs.js:22:17)
此外,在安装时也会出现 media-get 安装失败的提示,即便手动下载到对应目录也会在「检查 media-get 是否安装成功」过程中报错。该问题通过删除 script/setup.js 相关检测可解决。
media-get 下载的是 arm64.版本的吗?
另外,可以手动执行
/data/data/com.termux/files/home/melody/backend/src/service/media_fetcher/../../../bin/media-get -k " 十年" --searchType="song" -m --infoFormat=json -l silence
看看。
输出 null
…
media-get 下载的是 linux-arm64 版本,并且也修改权限 755 了
null 应该是 node 调用 media-get 输出的?试试命令行直接执行看看报什么错
/data/data/com.termux/files/home/melody/backend/src/service/media_fetcher/../../../bin/media-get -k " 十年" --searchType="song" -m --infoFormat=json -l debug
Will search in [bilibili douyin kugou kuwo migu netease qq youtube]
Post "https://music.163.com/weapi/cloudsearch/get/web": dial tcp: lookup music.163.com on [::1]:53: read udp [::1]:49090->[::1]:53: read: connection refused
Get "https://shc.y.qq.com/soso/fcgi-bin/search_for_qq_cp?format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=h5&needNewCode=1&w=%E5%8D%81%E5%B9%B4&perpage=20&n=20&p=1&remoteplace=txt.mqq.all": dial tcp: lookup shc.y.qq.com on [::1]:53: read udp [::1]:44239->[::1]:53: read: connection refused
Get "https://m.music.migu.cn/migumusic/h5/search/all?text=%E5%8D%81%E5%B9%B4&pageNo=1&pageSize=30": dial tcp: lookup m.music.migu.cn on [::1]:53: read udp [::1]:45544->[::1]:53: read: connection refused
Get "https://search.kuwo.cn/r.s?all=%E5%8D%81%E5%B9%B4&ft=music&client=kt&cluster=0&pn=0&rn=50&rformat=json&encoding=utf8": dial tcp: lookup search.kuwo.cn on [::1]:53: read udp [::1]:47446->[::1]:53: read: connection refused
Get "https://mobiles.kugou.com/api/v3/search/song?format=json&keyword=%E5%8D%81%E5%B9%B4&page=1&pagesize=30&showtype=1": dial tcp: lookup mobiles.kugou.com on [::1]:53: read udp [::1]:48213->[::1]:53: read: connection refused
Get "https://www.youtube.com/results?search_query=%E5%8D%81%E5%B9%B4": dial tcp: lookup www.youtube.com on [::1]:53: read udp [::1]:37652->[::1]:53: read: connection refused
Get "https://www.douyin.com/search/%E5%8D%81%E5%B9%B4": dial tcp: lookup www.douyin.com on [::1]:53: read udp [::1]:44015->[::1]:53: read: connection refused
Get "https://api.bilibili.com/x/web-interface/search/all/v2?page=1&page_size=10&platform=pc&single_column=0&keyword=%E5%8D%81%E5%B9%B4&preload=true": dial tcp: lookup api.bilibili.com on [::1]:53: read udp [::1]:39812->[::1]:53: read: connection refused
null
---------------------------App end----------------------------
Alloc = 0 MiB TotalAlloc = 0 MiB Sys = 69 MiB NumGC = 0
--------------------------------------------------------------
Cost time: 4.968594ms
你的 dns 有问题,搜索 dial tcp: lookup ::1 53 解决一下。
Since the Linux in Android is not so “standard”. /etc/resolv.conf is not available. The app then just keep looking up host in localhost:53.
This can be fixed only with proot, but will require a binary compiled for the same architecture as your termux installation:
Install necessary packages:
pkg install proot resolv-conf
Bind resolv.conf file to right place when executing binary:
proot -b $PREFIX/etc/resolv.conf:/etc/resolv.conf
cd melody && npm run app