来自分类 NodeJS2024-02-01 12:46:37
随着越来越多的工具不再支持 Nodejs 16, 是时候将服务器的 Nodejs 版本升级到18了, 服务器本来就安装了`nvm`, 所以升级也很简单, 直接 ```bash nvm install v18.18.2 nvm use 18 ``` 就行了, 可是已运行`node -v`, 漂亮, 直接报错 ``` node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node) node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node) node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node) node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node) node: /lib64/libstdc++.so.6: version ...
来自分类 NodeJS2024-01-24 15:37:38
### 错误信息 win10系统, nodejs v12.22, 安装`node-sass`报`Could not find any Visual Studio installation to use!`错误, 具体错误信息如下: ![Description](https://php.mmxiaowu.com/upload/202401/20240117202604_gkCPyKmw.png) ### 解决方法1 1. 以管理员方式打开`CMD` 2. 执行以下命令: ```bash npm install --g --production windows-build-tools ``` 3. 如果中途卡在`Successfully installed Python 2.7`, 解决方案如下: 按`win+r`打开运行, 输入`%temp%`, 在打开的资源管理器界面, 新建文件`dd_client_.log`, 打开`dd_client_.log`文件, 并输入`Closing installer. Return code: 3010.`, 保存文件, 最后重新执行步骤2即可...
来自分类 NodeJS2016-12-07 23:12:00
# 1. 安装 pm2 ```bash npm install pm2 -g ``` # 2. 写启动脚本 ```bash # vi ~/ecosystem.json ``` ```json { "apps" : [{ // Application #1 "name" : "api", "script" : "server.js", "merge_logs" : true, "cwd" : "/home/web/mmf-blog-api", "env": { "NODE_ENV": "development", "AWESOME_SERVICE_API_TOKEN": "xxx" }, "env_production" : { "NODE_ENV": "production" }, "exec_mode" : "cluster_mode", "log_date_format": "YYYY-MM-DD HH:m...
来自分类 NodeJS2016-12-07 22:12:00
# 1. 安装 ```bash npm install request --save-dev npm install socks5-http-client ``` # 2. 代码 ```javascript var request = require('request') var Agent = require('socks5-http-client/lib/Agent') var request_option = { url: 'http://www.google.com', agentClass: Agent, agentOptions: { socksHost: '127.0.0.1', socksPort: 1080 } } node.request(request_option, (err, res, body) => { // balabala }) ```...
来自分类 NodeJS2016-12-07 22:12:00
# Model.save 基于 entity 操作 ```javascript var doc = {username : 'model_demo_username', title : 'model_demo_title', content : 'model_demo_content'}; var Entity = new Model(doc); Entity.save(doc, function(error) { // do something }); ``` # Model.create 基于 model 操作 ```javascript var doc = {username : 'model_demo_username', title : 'model_demo_title', content : 'model_demo_content'}; Model.create(doc, function(error) { // do something }); ``` # Model.find ```javascript Model.find(query, fiel...