关于NeteaseCloudMusicApi就不多说了,放点官方介绍把!
https://binaryify.github.io/NeteaseCloudMusicApi
1:安装Npm
因为之前有个旧版本的Npm所以就先卸载了把
yum remove nodejs npm -y
卸载后开始安装
yum install npm - y
2:安装nodejs最新版本
npm install -g n
n latest
安装后可以输入n切换版本
但是坑来了,切换完版本后我发现版本号还是旧版本的nodejs
node -v

解决方法:
1:查看 node 当前安装路径
which node
比如你的路径是:/usr/local/bin/node
2:编辑环境文件
nano ~/.bash_profile
加入以下内容
export N_PREFIX=/usr/local
export PATH=$N_PREFIX/bin:$PATH
执行source使修改生效。
source ~/.bash_profile
这时候再查看版本就发现版本是最新了
3:安装NeteaseCloudMusicApi
git clone git@github.com:Binaryify/NeteaseCloudMusicApi.git
cd NeteaseCloudMusicApi
npm install
但是你又会发现一个很神奇的坑
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN NeteaseCloudMusicApi@2.20.5 No repository field.
百度了下找到个解决方法:
nano package.json
在文件底部加上以下代码
,"repository" :
{ "type" : "git"
, "url" : "https://github.com/npm/npm.git"
}
}
然后再运行安装
npm install
这就安装好了,开始跑起来
node app.js
如果要修改修改端口可以修改app.js 修改底部的3000为你想要的端口
或者用以下命令跑
PORT=4000 node app.js
附上一张成功截图
