[Pagoda panel deployment nodeJs project] Netease cloud nodeJs is deployed on the cloud server, nanny-level tutorial, write Netease cloud interface and use your own interface without being controlled by others

I read a lot of deployments, either there are few steps, or the writing is too concise, which is not friendly to novices


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

  1. Environmental requirements ==== "NodeJS 12+ environment is required
  2. There is a server, and the pagoda panel has been installed
  3. 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

insert image description here
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
insert image description here

2. Use steps

1. Run locally first

  1. git clone to local,
  2. npm install download node_modules package
  3. 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 .


insert image description here
显示链接就是运行成功

2. Test interface

open link

http://localhost:3000/search?keywords=微笑
http://localhost:3000/banner

insert image description here
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
insert image description here

2. Compress the NetEase Cloud nodeJs project and upload it to the Pagoda panel

insert image description here
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
    insert image description here

3. Add a nodeJs project

回到宝塔面板的软件商店

  • clickpm2管理器

  • insert image description here

  • Switch the nodejs version to 12 or above, and around 14 is recommended. I choose here

  • insert image description here

4. Fill in the parameters

In the popup box of the pm2 manager, switch back to the project list点击添加项目
insert image description here

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
insert image description here

5. Let go of the firewall, pagoda panel + server background panel

insert image description here
Servers such as Alibaba Cloud, Tencent Cloud, and Baidu Cloud are not demonstrated here. Because I am UCloud, a niche platform.

insert image description here

6. Test interface

Take the banner carousel image to test

insert image description here

Try it in a small program?
insert image description here
insert image description here
insert image description here


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.

Guess you like

Origin blog.csdn.net/qq_51055690/article/details/129516937