I read a lot of deployments, either there are few steps, or the writing is too concise, which is not friendly to novices
Article directory
foreword
reference link
The whole process of Netease Cloud Music API installation and deployment [detailed explanation of local running projects and remote deployment]
How to launch node
.
Summarize this article
提示:这里可以添加本文要记录的大概内容:
The github portal, you can download its code with one click to
the github address running Netease cloud nodeJs locally
- Environmental requirements ==== "NodeJS 12+ environment is required
- There is a server, and the pagoda panel has been installed
- Have a certain foundation, know cmd, and can npm i download node_modules
提示:以下是本篇文章正文内容,下面案例可供参考
1. Download the Netease cloud nodejs project
1. git clone download, two ways
git clone [email protected]:Binaryify/NeteaseCloudMusicApi.git
cd NeteaseCloudMusicApi
npm install
or
git clone https://github.com/Binaryify/NeteaseCloudMusicApi.git
cd NeteaseCloudMusicApi
npm install
2. Run the project
node app.js
Under the project path, open cmd. Enter the statement without the preceding $ sign
It's all in the document,
Can't get in, enter this link
Netease cloud nodeJs
2. Use steps
1. Run locally first
- git clone to local,
- npm install download node_modules package
- npm start or node app.js run
如果报错
(node:10304) UnhandledPromiseRejectionWarning: Error
[ERR_REQUIRE_ESM]: Must use import to load ES Module:
E:\Vue_Code\2023-03\NeteaseCloudMusicApi\node_modules\axios\index.js
require() of ES modules is not supported. require() of
E:\Vue_Code\2023-03\NeteaseCloudMusicApi\node_modules\axios\index.js
from E:\Vue_Code\2023-03\NeteaseCloudMusicApi\util\request.js is an ES
module file as it is a .js file whose nearest parent package. json
contains “type”: “module” which defines all .js files in that package
scope as ES modules.
Please move to Netease cloud nodejsAPI failed to run, npm start failed to solve the solution json contains “type“: “module“ which defines all .
显示链接就是运行成功
2. Test interface
open link
http://localhost:3000/search?keywords=微笑
http://localhost:3000/banner
The appearance of json data indicates that there is no problem
3. Deploy the server
1. Install the pm2 manager on the pagoda panel
Use the Xshell 7 software to remotely connect to the server and install it with the command line, which is not provided here. Anyway, after the installation, there will be this pm2 manager
in the store
2. Compress the NetEase Cloud nodeJs project and upload it to the Pagoda panel
Some say that node_modeuls can be omitted, just click refresh next to the path after uploading to the pagoda. I directly compressed all of them here.
打开宝塔面板=》文件
- Find the www folder
- Go to the www folder and create a new folder called wangyiyun to store your projects
- Upload the compressed package and decompress it after the upload is successful
3. Add a nodeJs project
回到宝塔面板的软件商店
-
click
pm2管理器
-
Switch the nodejs version to 12 or above, and around 14 is recommended. I choose here
4. Fill in the parameters
In the popup box of the pm2 manager, switch back to the project list点击添加项目
The directory is the uploaded project, start the file npm start or select the app.js file
If you submit an error report
/bin/sh: line 7: npm: command not found
, it means that the version of nodeJs is low. I searched for a long time for the error report and I don’t know the reason. The result is that the version is four o’clock.
After submission, the page has an item
5. Let go of the firewall, pagoda panel + server background panel
Servers such as Alibaba Cloud, Tencent Cloud, and Baidu Cloud are not demonstrated here. Because I am UCloud, a niche platform.
6. Test interface
Take the banner carousel image to test
Try it in a small program?
Summarize
If you have any questions, please private message me. I am also a novice in Linus, and I don’t know much about servers. Deployment succeeded. Then, if you write a project, you can call your own interface.