1. 程式人生 > WINDOWS開發 >yapi安裝部署

yapi安裝部署

1.安裝nodejs 7.6+

2. 安裝mongodb

>mongod --config F:\mongodb\conf\mongodb.conf

3. 安裝yapi


D:\yapi>npm install -g yapi-cli --registry https://registry.npm.taobao.org
C:\Users\14218\AppData\Roaming\npm\yapi -> C:\Users\14218\AppData\Roaming\npm\node_modules\yapi-cli\bin\yapi-cli
C:\Users\14218\AppData\Roaming\npm\yapi-cli -> C:\Users\14218\AppData\Roaming\npm\node_modules\yapi-cli\bin\yapi-cli

+ [email protected]
added 266 packages from 125 contributors in 29.525s

D:\yapi>

依賴庫安裝完成,正在初始化資料庫mongodb...
> [email protected] install-server D:\yapi\my-yapi\vendors > node server/install.js
log: mongodb load success...
初始化管理員賬號成功,賬號名:"[email protected]",密碼:"ymfe.org"
部署成功,請切換到部署目錄,輸入: "node vendors/server/app.js" 指令啟動伺服器,然後在瀏覽器開啟 http://127.0.0.1:3000 訪問


當前安裝版本: 1.9.2
連線資料庫成功!
開始下載平臺檔案壓縮包...
http://registry.npm.taobao.org/yapi-vendor/download/yapi-vendor-1.9.2.tgz
部署檔案完成,正在安裝依賴庫...
npm
WARN deprecated [email protected]: In 6.x,the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
npm WARN deprecated

[email protected]: ???? Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated [email protected]: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated [email protected]: Check out CommitLint which provides the same functionality with a more user-focused experience.
npm
WARN deprecated [email protected]: Please use @koa/multer instead,see <https://github.com/koajs/multer>
npm WARN
deprecated [email protected]: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: [email protected]<3 is no longer maintained and not recommended for usage due to the number of issues. Please,upgrade your dependencies to the actual version of [email protected]
npm WARN deprecated [email protected]: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN
deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm
WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm
WARN deprecated [email protected]: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN
deprecated [email protected]: ???? Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,bug fixes,and security patches. If you are unable to upgrade at this time,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: use String.prototype.padStart()
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN
deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated
[email protected]: Critical security bugs fixed in 2.5.5
npm WARN deprecated
[email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN
deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated
[email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN
deprecated [email protected]: CircularJSON is in maintenance only,flatted is its successor.
npm WARN
deprecated [email protected]: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated
[email protected]: [email protected]<3 is no longer maintained and not recommended for usage due to the number of issues. Please,upgrade your dependencies to the actual version of [email protected]
npm WARN deprecated [email protected]: Please use the native JSON object instead of JSON 3
> [email protected] install D:\yapi\my-yapi\vendors\node_modules\dtrace-provider > node-gyp rebuild || node suppress-error.js

D:\yapi\my-yapi\vendors\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp
ERR! configure error gyp ERR! stack Error: Command failed: D:\python\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "<string>",line 1 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at maybeClose (internal/child_process.js:970:16) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd D:\yapi\my-yapi\vendors\node_modules\dtrace-provider gyp ERR!
node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok
> [email protected] postinstall D:\yapi\my-yapi\vendors\node_modules\core-js > node -e "try{require(‘./postinstall‘)}catch(e){}"
npm WARN [email protected] requires a peer of [email protected]^4.1.12 but none is installed. You must install peer dependencies yourself. npm WARN
[email protected] requires a peer of [email protected]>=8.4.2 <11.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected]^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected]^0.14.0 || ^15.0.1 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected]^0.14.0 || ^15.0.1 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected]>=1.8.0 but none is installed. You must install peer dependencies yourself. added 332 packages from 331 contributors in 45.089s
依賴庫安裝完成,正在初始化資料庫mongodb...
> [email protected] install-server D:\yapi\my-yapi\vendors > node server/install.js
log: mongodb load success...
初始化管理員賬號成功,賬號名:"[email protected]",密碼:"ymfe.org"
部署成功,請切換到部署目錄,輸入: "node vendors/server/app.js" 指令啟動伺服器,然後在瀏覽器開啟 http://127.0.0.1:3000 訪問

4. 啟動yapi.

D:\yapi>cd my-yapi

D:\yapi\my-yapi>node vendors/server/app.js
log: -------------------------------------swaggerSyncUtils constructor-----------------------------------------------
log: 服務已啟動,請開啟下面連結訪問:
http://127.0.0.1:3000/
log: mongodb load success...

(node:3460) DeprecationWarning: collection.update is deprecated. Use updateOne,updateMany,or bulkWrite instead.
(node:3460) DeprecationWarning: collection.remove is deprecated. Use deleteOne,deleteMany,or bulkWrite instead.
D:\yapi>cd my-yapi