简单搭建nodejs服务器,用于爬虫js逆向.
1、安装镜像源
- 下载nrm
npm install -g nrm
设置下载源:(最好使用npm源或者淘宝源)
例子:npm config set registry http://registry.npmjs.org
查看是否设置成功:npm config get registry
- 安装node
wget https://nodejs.org/download/release/v15.10.0/node-v15.10.0-linux-x64.tar.xz
tar -xvf node-v15.10.0-linux-x64.tar.xz
sudo mv node-v15.10.0-linux-x64/ /usr/local/node
sudo ln -s /usr/local/node/bin/node /usr/bin/node
sudo ln -s /usr/local/node/bin/npm /usr/bin/npm
3.安装 成功
nrm ls
nrm use npm 使用npm源
4.使用express
npm i express
5.根据项目要求配置package.json
示例:
{
"dependencies": {
"express": "^4.18.2",
"connect-multiparty": "2.2.0",
"morgan": "1.10.0",
"node-webcrypto-ossl": "2.1.3",
"tweetnacl-sealedbox-js": "1.2.0",
"tweetnacl": "1.0.3"
}
}
---------
npm install