yapi icon indicating copy to clipboard operation
yapi copied to clipboard

YApi 安装出现问题请看这里

Open hellosean1025 opened this issue 8 years ago • 123 comments
trafficstars

  1. 确保 node 版本=> 7.6,请运行 node -v 查看版本号
  2. 确保 mongodb 版本 => 2.6,请运行 mongo --version 查看版本号
  3. 确保安装了 npm, 运行 npm -v 查看版本号
  4. 确保安装了 git,运行 git --version 查看版本号
  5. 确保安装了 node-gyp 环境,配置方法

确认版本号没问题,请删除原有的安装文件和数据库,重新安装。

如果安装了 yapi-cli 工具,执行 yapi server 找不到命令,可尝试执行 yapi-cli server

如果是使用了yapi server 可视化部署出的问题,可查看下文档-> 内网部署方式,熟悉 docker 童鞋可以使用 docker 部署,docker 部署的教程可以在 https://github.com/YMFE/yapi 这里找到。

如果还是无法安装,请不要选择最新的版本,可选择上一个版本或上上一个版本等,最新版本出问题的概率会比较大。

有问题请在下面留言,感谢大家的反馈。

hellosean1025 avatar Nov 02 '17 03:11 hellosean1025

请问如果nginx反代到yapi的3000端口,怎么办,内网访问yapi无问题

我是这么设置的

	location ^~ /api/ {
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_pass      http://127.0.0.1:3000;
	}

但是不行

darkless456 avatar Nov 28 '17 04:11 darkless456

@darkless456 我这边是这样配置的

 location / {
            proxy_http_version 1.1;
	    proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection "upgrade";
            proxy_pass   http://127.0.0.1:3011;
    }

hellosean1025 avatar Feb 01 '18 11:02 hellosean1025

博主, 我使用的是内网部署方式2,部署到自己服务器上,在进行npm run install-server时,会报

error: MongoError: auth failed, mongodb Authentication failed
error: MongoError: auth failedmongodb connect error

根据官网 centos 环境搭建的基础环境,连接mongo 还会报错这是什么原因?

juntingl avatar Feb 23 '18 06:02 juntingl

@darkless456 你好,想问你下,你内网部署成功了嘛?

juntingl avatar Feb 23 '18 06:02 juntingl

Authentication failed 一般是因为数据库权限问题,建议第一次安装 mongodb 不要开启权限认证,config 配置文件也不需要填写数据库用户名和密码,等熟悉了再考虑设置 mongodb 权限。 @Twitchboy @dzjwan521

hellosean1025 avatar Feb 23 '18 08:02 hellosean1025

@Twitchboy @dzjwan521


# mongo
> db.createUser({user:'test1',pwd:'test1',roles:[{role:'root',db:'admin'}]})
> db.auth('test1','test1')

# service mongod stop
# service mongod start

joriewong avatar Mar 01 '18 08:03 joriewong

部署问题 Error: WARNING: The useMongoClient option is no longer necessary in mongoose 5.x, please remove it.

ChaNHHHHH avatar Mar 10 '18 09:03 ChaNHHHHH

[root@struggle ~]# yapi server 在浏览器打开 http://0.0.0.0:9090 访问。非本地服务器,请将 0.0.0.0 替换成指定的域名或ip /bin/sh: xdg-open: command not found

stringstru avatar Apr 09 '18 01:04 stringstru

你们不支持nginx代理吧 image

wei772 avatar Apr 10 '18 09:04 wei772

@stringstru 先安装/重装下xdg-utils

sudo apt-get install --reinstall xdg-utils

flynntsc avatar Apr 10 '18 10:04 flynntsc

请问部署的时候一直报权限问题怎么解决啊

node lib/aesprim.js > generated/aesprim-browser.js sh: generated/aesprim-browser.js: Permission denied

最后会导致 Error: Cannot find module 'json-schema-faker' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/bigdata/yapi/vendors/server/utils/commons.js:23:13) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/bigdata/yapi/vendors/server/install.js:3:17) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32)

undeadwing avatar Apr 11 '18 03:04 undeadwing

您好,请问使用文档内网内否使用?

lushenchen avatar Apr 13 '18 09:04 lushenchen

@undeadwing 删除 node_modules 重新 npm install --production 试试

hellosean1025 avatar Apr 16 '18 08:04 hellosean1025

@ChaNHHHHH 警告错误,不用管

hellosean1025 avatar Apr 16 '18 08:04 hellosean1025

@suxiaoxin 请帮忙看下安装依赖时出现的问题

问题提示如下: [localhost:vendors yrzty$ npm install --production --registry https://resgistry.npm.taobao.org npm WARN [email protected] license should be a valid SPDX license expression

npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to https://resgistry.npm.taobao.org/btoa failed, reason: getaddrinfo ENOTFOUND resgistry.npm.taobao.org resgistry.npm.taobao.org:443 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in: npm ERR! /Users/yrzty/.npm/_logs/2018-05-07T04_05_58_093Z-debug.log [localhost:vendors yrzty$ 环境是macos 10.11.6 node版本:10.0.0 npm版本:5.6.0 mongodb安装的是[email protected] 2018-05-07T04_05_58_093Z-debug.log

补充:没有设定proxy,安装其他软件也OK啊,网络可以正常访问。

yrzty21 avatar May 07 '18 04:05 yrzty21

>  node server/install.js

 log: mongodb load success...

Error:  (node:3365) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: 初始化管理员账号 "[email protected]" 失败, E11000 duplicate key error collection: yapi.user index: email_1 dup key: { : "[email protected]" }

初始化管理员账号[email protected]失败是什么原因呢?是不能用这个邮箱吗?

kwen8 avatar May 09 '18 03:05 kwen8

update 失败, 现象如下。

环境是在华为云Centos7.4上会出这个问题。 在本机linux不这样。

fatal: unable to access 'https://github.com/nhnent/raphael.git/': Peer reports incompatible or unsupported protocol version.

zheyvsu avatar May 13 '18 08:05 zheyvsu

解决了。 执行下面这个命令。

yum update -y nss curl libcurl

如果还不行,再更新一下git版本。升级到2.x

zheyvsu avatar May 13 '18 08:05 zheyvsu

感谢yapi群里的 @小容 的解答,我用她提供的方法成功跑起来了:

一、配置MongoDB 第一步:创建数据库 use yapi 第二步:创建用户并配置权限 db.createUser({user:"username",pwd:"123456",roles:[{"role":"readWrite","db":"yapi"}]})

二、配置YApi(config.json)

"db": {
   "servername": "127.0.0.1",
   "DATABASE": "yapi",
   "port": 27017,
   "user": "username",
   "pass": "123456",
   "authSource": ""
 }

SHERlocked93 avatar May 17 '18 15:05 SHERlocked93

你好: 我用了 yapi ,但服务器重启后MongoDB里面存的 yapi 的所有数据都丢失了,有解决方法恢复吗?

发自网易邮箱大师 在2018年5月17日 23:37,YuQian[email protected] 写道:

感谢yapi群里的 @小容 的解答,我用她提供的方法成功跑起来了:

一、配置MongoDB 第一步:创建数据库 use yapi 第二步:创建用户并配置权限 db.createUser({user:"username",pwd:"123456",roles:[{"role":"readWrite","db":"yapi"}]})

二、配置YApi(config.json)

"db": { "servername":"127.0.0.1", "DATABASE":"yapi", "port":27017, "user":"username", "pass":"123456", "authSource":"" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

stoneFive avatar May 17 '18 15:05 stoneFive

运行 yapi server 浏览器中点击开始部署过程中出现以下错误:

部署文件完成,正在安装依赖库...

> [email protected] install D:\xampp\htdocs\api\my-yapi\vendors\node_modules\dtrace-provider
> node-gyp rebuild || node suppress-error.js


D:\npm\npm_global\node_modules\yapi-cli\node_modules\ws\lib\WebSocket.js:358
      else throw new Error('not opened');
           ^

Error: not opened
    at WebSocket.send (D:\npm\npm_global\node_modules\yapi-cli\node_modules\ws\lib\WebSocket.js:358:18)
    at Socket.<anonymous> (D:\npm\npm_global\node_modules\yapi-cli\src\commands\server.js:66:16)
    at emitOne (events.js:121:20)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:597:20)

OS: windows 10, node version: 10.1.0 9.2.0 8.11.2 mongo version: v3.2.7 yapi version: v1.3.15 v1.3.16

magicds avatar May 24 '18 02:05 magicds

@cdswyda 确保安装了 node-gyp 环境,配置方法

hellosean1025 avatar May 24 '18 12:05 hellosean1025

@hellosean1025 thank you. node-gyp 的环境应该是没有问题的, 最后以本地部署的命令行方式顺利完成了。

magicds avatar May 24 '18 14:05 magicds

您好,我使用命令行部署后,启动正常,但是没有yapi命令, image

MRwangyd avatar May 30 '18 05:05 MRwangyd

@hellosean1025 麻烦帮忙看下

MRwangyd avatar May 30 '18 06:05 MRwangyd

nginx代理yapi时 location ^~ /yapi 这样配置,找不到js文件,怎么解决,是否支持location 加一层目录 image

MRwangyd avatar May 30 '18 06:05 MRwangyd

@MRwangyd 这个问题有没有解决掉? 我也有这个需求

magicds avatar Jul 08 '18 15:07 magicds

@MRwangyd ./yapi.js 是几个意思? 不是应该是 node app.js 吗

gaoxiaomumu avatar Jul 12 '18 06:07 gaoxiaomumu

可视化部署成功,但是在启动app.js的时候报错 `node app.js module.js:487 throw err; ^

Error: Cannot find module 'jwa' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object. (/home/dc2-user/my-yapi/vendors/node_modules/jws/lib/sign-stream.js:4:11) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object. (/home/dc2-user/my-yapi/vendors/node_modules/jws/index.js:2:18) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32)`

已解决 删除 node_modules 重新 npm install --production

JacobHZ avatar Jul 16 '18 10:07 JacobHZ

windows10 下,client运行打包之后报错 Uncaught TypeError: $export is not a function 是否打包配置需要改动? image @hellosean1025 @darkless456 @dzjwan521

chentianyuan avatar Jul 22 '18 12:07 chentianyuan