Error: Cannot find module 'json-schema-faker' YAPI部署
大家好,我是烤鴨:
? ? ? ?采坑實錄。
? ? ? ?安裝?YAPI?接口項目時出現的這個問題,如果你不是這個情況出現的這個報錯,就不用繼續看了。
? ? ? ?YAPI的 github 地址:
? ? ? ?https://github.com/YMFE/yapi
?
1.場景
? ???安裝?YAPI?接口項目。當時日志沒找,從github的看到有人提的issue,跟我的一樣,如下。
?
2.報錯信息
當前安裝版本: 1.5.7
連接數據庫成功!
開始下載平臺文件壓縮包...
http://registry.npm.taobao.org/yapi-vendor/download/yapi-vendor-1.5.7.tgz
部署文件完成,正在安裝依賴庫...
npm
WARN
deprecated
nomnom@1.5.2: Package no longer supported. Contact?support@npmjs.com?for more info.
jsonpath@1.0.0 postinstall /data/my-yapi/vendors/node_modules/jsonpath > node lib/aesprim.js > generated/aesprim-browser.js
sh: generated/aesprim-browser.js: Permission denied
npm
WARN
eslint-config-modular@4.2.2 requires a peer of eslint@>=3.0.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
mongoose-auto-increment@5.0.1 requires a peer of mongoose@^4.1.12 but none is installed. You must install peer dependencies yourself.
npm
WARN
yapi-vendor@1.4.4 license should be a valid SPDX license expression
npm
WARN
The package moment is included as both a dev and production dependency.
npm
ERR!
code
ELIFECYCLE
npm
ERR!
errno
1
npm
ERR!
jsonpath@1.0.0 postinstall:?node lib/aesprim.js > generated/aesprim-browser.js
npm
ERR!
Exit status 1
npm
ERR!
npm
ERR!
Failed at the jsonpath@1.0.0 postinstall script.
npm
ERR!
This is probably not a problem with npm. There is likely additional logging output above.
npm
ERR!
A complete log of this run can be found in:
npm
ERR!
/root/.npm/_logs/2019-02-11T09_05_54_645Z-debug.log
依賴庫安裝完成,正在初始化數據庫mongodb...
yapi-vendor@1.4.4 install-server /data/my-yapi/vendors > node server/install.js
Error: module.js:540 throw err; ^ Error: Cannot find module 'json-schema-faker' at Function.Module._resolveFilename (module.js:538:15) at Function.Module._load (module.js:468:25) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (/data/my-yapi/vendors/server/utils/commons.js:19:13) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (/data/my-yapi/vendors/server/install.js:3:17) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32)
3.原因及解決方案
? ? ? 這個錯誤的原因在于 nodejs 的 運行權限和運行 yapi -server 的權限不一致。
? ? ? 解決:
chown -R root:root /nodejs安裝目錄(環境變量配置的目錄)?
總結
以上是生活随笔為你收集整理的Error: Cannot find module 'json-schema-faker' YAPI部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 线程同步以及yield()、wait()
- 下一篇: Sonar插件集合