安装Yapi时,出现json-schema-faker模块找不到问题


今天换了一台机器按以前的方式安装Yapi工具时,竟然出现了错误。

一 安装yapi时,出现了下面的报错,一开始以为没安装json-schema-faker模块。后面通过找资料,发现是权限问题,
使用chown更改下权限

yapi-vendor@1.5.14 install-server /data/vhosts/vhosts.website/yapi/vendors
>  node server/install.js

Error:  internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'json-schema-faker'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/data/vhosts/vhosts.website/yapi/vendors/server/utils/commons.js:21:13)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/data/vhosts/vhosts.website/yapi/vendors/server/install.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)

二 更改安装目录权限(环境变量配置的目录),不是yapi的目录,是nodejs的目录

chown -R root:root /nodejs安装目录

三 然后再安装,就不会有问题了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM